Skip to content

Commit ec03782

Browse files
MasaoFujiipull[bot]
authored andcommitted
Add regression test for TRUNCATE on foreign table not supporting TRUNCATE.
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
1 parent 8e8ebf9 commit ec03782

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

contrib/file_fdw/expected/file_fdw.out

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,8 @@ UPDATE agg_csv SET a = 1;
246246
ERROR: cannot update foreign table "agg_csv"
247247
DELETE FROM agg_csv WHERE a = 100;
248248
ERROR: cannot delete from foreign table "agg_csv"
249+
TRUNCATE agg_csv;
250+
ERROR: cannot truncate foreign table "agg_csv"
249251
-- but this should be allowed
250252
SELECT * FROM agg_csv FOR UPDATE;
251253
a | b

contrib/file_fdw/sql/file_fdw.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ SELECT tableoid::regclass, b FROM agg_csv;
166166
INSERT INTO agg_csv VALUES(1,2.0);
167167
UPDATE agg_csv SET a = 1;
168168
DELETE FROM agg_csv WHERE a = 100;
169+
TRUNCATE agg_csv;
169170
-- but this should be allowed
170171
SELECT * FROM agg_csv FOR UPDATE;
171172

0 commit comments

Comments
 (0)