Skip to content

Commit

Permalink
Add regression test for TRUNCATE on foreign table not supporting TRUN…
Browse files Browse the repository at this point in the history
…CATE.

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/[email protected]
  • Loading branch information
MasaoFujii committed Jul 20, 2022
1 parent 13d8388 commit ecc84b9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions contrib/file_fdw/expected/file_fdw.out
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions contrib/file_fdw/sql/file_fdw.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit ecc84b9

Please sign in to comment.