Add regression test for TRUNCATE on foreign table not supporting TRUNCATE.
authorFujii Masao <[email protected]>
Wed, 20 Jul 2022 00:35:14 +0000 (09:35 +0900)
committerFujii Masao <[email protected]>
Wed, 20 Jul 2022 00:35:14 +0000 (09:35 +0900)
file_fdw doesn't support INSERT, UPDATE, DELETE and TRUNCATE.
It has the regression test that confirms that INSERT, UPDATE and DELETE
fail on its foreign table, but not TRUNCATE yet. It's better to
also test TRUNCATE fails on a foreign table not allowing TRUNCATE,
for test coverage. This commit adds that regression test using file_fdw.

Author: Yugo Nagata
Reviewed-by: Fujii Masao
Discussion: https://postgr.es/m/20220630104812.ec1556481452c019874f4ac9@sraoss.co.jp

contrib/file_fdw/expected/file_fdw.out
contrib/file_fdw/sql/file_fdw.sql

index 0029f36b3593ce9f7f05138cf6b89817de3e39a0..261af1a8b5fe5f2986c24a6ee6301245bb3de0f6 100644 (file)
@@ -246,6 +246,8 @@ UPDATE agg_csv SET a = 1;
 ERROR:  cannot update foreign table "agg_csv"
 DELETE FROM agg_csv WHERE a = 100;
 ERROR:  cannot delete from foreign table "agg_csv"
+TRUNCATE agg_csv;
+ERROR:  cannot truncate foreign table "agg_csv"
 -- but this should be allowed
 SELECT * FROM agg_csv FOR UPDATE;
   a  |    b    
index 563d824ccc8c85373bc6dbf3114e69724662c12f..46670397ca56f1fd7fbb04a4ef4849331af353e0 100644 (file)
@@ -166,6 +166,7 @@ SELECT tableoid::regclass, b FROM agg_csv;
 INSERT INTO agg_csv VALUES(1,2.0);
 UPDATE agg_csv SET a = 1;
 DELETE FROM agg_csv WHERE a = 100;
+TRUNCATE agg_csv;
 -- but this should be allowed
 SELECT * FROM agg_csv FOR UPDATE;