Skip to content

Commit 0efa513

Browse files
committed
Remove useless tests for TRUNCATE on foreign tables
foreign_data has kept around a set of tests for TRUNCATE to look after the case of foreign tables, with[out] inheritance and with[out] partitions, assuming that the command is not supported for this relkind. However, TRUNCATE is supported on foreign tables if the FDW involved is able to handle the command, like postgres_fdw. Note that postgres_fdw includes tests to cover all the cases removed by this commit (which had misleading comments), so these did not provide any additional coverage anyway. Author: Yugo Nagata Discussion: https://postgr.es/m/20220527172543.0a2fdb469cf048b81c0967d3@sraoss.co.jp
1 parent 12e28aa commit 0efa513

File tree

2 files changed

+0
-18
lines changed

2 files changed

+0
-18
lines changed

src/test/regress/expected/foreign_data.out

-10
Original file line numberDiff line numberDiff line change
@@ -1822,11 +1822,6 @@ Server: s0
18221822
FDW options: (delimiter ',', quote '"', "be quoted" 'value')
18231823
Inherits: fd_pt1
18241824

1825-
-- TRUNCATE doesn't work on foreign tables, either directly or recursively
1826-
TRUNCATE ft2; -- ERROR
1827-
ERROR: foreign-data wrapper "dummy" has no handler
1828-
TRUNCATE fd_pt1; -- ERROR
1829-
ERROR: foreign-data wrapper "dummy" has no handler
18301825
DROP TABLE fd_pt1 CASCADE;
18311826
NOTICE: drop cascades to foreign table ft2
18321827
-- IMPORT FOREIGN SCHEMA
@@ -2047,11 +2042,6 @@ ALTER TABLE fd_pt2 ATTACH PARTITION fd_pt2_1 FOR VALUES IN (1); -- ERROR
20472042
ERROR: child table is missing constraint "fd_pt2chk1"
20482043
ALTER FOREIGN TABLE fd_pt2_1 ADD CONSTRAINT fd_pt2chk1 CHECK (c1 > 0);
20492044
ALTER TABLE fd_pt2 ATTACH PARTITION fd_pt2_1 FOR VALUES IN (1);
2050-
-- TRUNCATE doesn't work on foreign tables, either directly or recursively
2051-
TRUNCATE fd_pt2_1; -- ERROR
2052-
ERROR: foreign-data wrapper "dummy" has no handler
2053-
TRUNCATE fd_pt2; -- ERROR
2054-
ERROR: foreign-data wrapper "dummy" has no handler
20552045
DROP FOREIGN TABLE fd_pt2_1;
20562046
DROP TABLE fd_pt2;
20572047
-- foreign table cannot be part of partition tree made of temporary

src/test/regress/sql/foreign_data.sql

-8
Original file line numberDiff line numberDiff line change
@@ -746,10 +746,6 @@ ALTER TABLE fd_pt1 RENAME CONSTRAINT fd_pt1chk3 TO f2_check;
746746
\d+ fd_pt1
747747
\d+ ft2
748748

749-
-- TRUNCATE doesn't work on foreign tables, either directly or recursively
750-
TRUNCATE ft2; -- ERROR
751-
TRUNCATE fd_pt1; -- ERROR
752-
753749
DROP TABLE fd_pt1 CASCADE;
754750

755751
-- IMPORT FOREIGN SCHEMA
@@ -833,10 +829,6 @@ ALTER TABLE fd_pt2 ATTACH PARTITION fd_pt2_1 FOR VALUES IN (1); -- ERROR
833829
ALTER FOREIGN TABLE fd_pt2_1 ADD CONSTRAINT fd_pt2chk1 CHECK (c1 > 0);
834830
ALTER TABLE fd_pt2 ATTACH PARTITION fd_pt2_1 FOR VALUES IN (1);
835831

836-
-- TRUNCATE doesn't work on foreign tables, either directly or recursively
837-
TRUNCATE fd_pt2_1; -- ERROR
838-
TRUNCATE fd_pt2; -- ERROR
839-
840832
DROP FOREIGN TABLE fd_pt2_1;
841833
DROP TABLE fd_pt2;
842834

0 commit comments

Comments
 (0)