aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFujii Masao <fujii@postgresql.org>2022-07-20 09:35:14 +0900
committerFujii Masao <fujii@postgresql.org>2022-07-20 09:35:14 +0900
commitecc84b916f8f36924e2b3de358045edfc3205e5a (patch)
treeab430c8ea32030697eb47b05a42ace0e583ad65a
parent13d83881514856353dc86575eb0fc28132349a60 (diff)
downloadpostgresql-ecc84b916f8f36924e2b3de358045edfc3205e5a.tar.gz
postgresql-ecc84b916f8f36924e2b3de358045edfc3205e5a.zip
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
-rw-r--r--contrib/file_fdw/expected/file_fdw.out2
-rw-r--r--contrib/file_fdw/sql/file_fdw.sql1
2 files changed, 3 insertions, 0 deletions
diff --git a/contrib/file_fdw/expected/file_fdw.out b/contrib/file_fdw/expected/file_fdw.out
index 0029f36b359..261af1a8b5f 100644
--- a/contrib/file_fdw/expected/file_fdw.out
+++ b/contrib/file_fdw/expected/file_fdw.out
@@ -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
diff --git a/contrib/file_fdw/sql/file_fdw.sql b/contrib/file_fdw/sql/file_fdw.sql
index 563d824ccc8..46670397ca5 100644
--- a/contrib/file_fdw/sql/file_fdw.sql
+++ b/contrib/file_fdw/sql/file_fdw.sql
@@ -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;