@@ -25,7 +25,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/truncate.out --la
2525 SELECT * FROM truncate_a;
2626 col1
2727 ------
28- @@ -32,42 +34,27 @@
28+ @@ -32,42 +34,34 @@
2929 -- Test foreign-key checks
3030 CREATE TABLE trunc_b (a int REFERENCES truncate_a);
3131 CREATE TABLE trunc_c (a serial PRIMARY KEY);
@@ -37,72 +37,83 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/truncate.out --la
3737-DETAIL: Table "trunc_b" references "truncate_a".
3838-HINT: Truncate table "trunc_b" at the same time, or use TRUNCATE ... CASCADE.
3939+ERROR: "truncate_a" is referenced by foreign key from table "trunc_b"
40+ +HINT: truncate dependent tables at the same time or specify the CASCADE option
4041 TRUNCATE TABLE truncate_a,trunc_b; -- fail
4142-ERROR: cannot truncate a table referenced in a foreign key constraint
4243-DETAIL: Table "trunc_e" references "truncate_a".
4344-HINT: Truncate table "trunc_e" at the same time, or use TRUNCATE ... CASCADE.
4445+ERROR: "truncate_a" is referenced by foreign key from table "trunc_e"
46+ +HINT: truncate dependent tables at the same time or specify the CASCADE option
4547 TRUNCATE TABLE truncate_a,trunc_b,trunc_e; -- ok
4648 TRUNCATE TABLE truncate_a,trunc_e; -- fail
4749-ERROR: cannot truncate a table referenced in a foreign key constraint
4850-DETAIL: Table "trunc_b" references "truncate_a".
4951-HINT: Truncate table "trunc_b" at the same time, or use TRUNCATE ... CASCADE.
5052+ERROR: "truncate_a" is referenced by foreign key from table "trunc_b"
53+ +HINT: truncate dependent tables at the same time or specify the CASCADE option
5154 TRUNCATE TABLE trunc_c; -- fail
5255-ERROR: cannot truncate a table referenced in a foreign key constraint
5356-DETAIL: Table "trunc_d" references "trunc_c".
5457-HINT: Truncate table "trunc_d" at the same time, or use TRUNCATE ... CASCADE.
5558+ERROR: "trunc_c" is referenced by foreign key from table "trunc_d"
59+ +HINT: truncate dependent tables at the same time or specify the CASCADE option
5660 TRUNCATE TABLE trunc_c,trunc_d; -- fail
5761-ERROR: cannot truncate a table referenced in a foreign key constraint
5862-DETAIL: Table "trunc_e" references "trunc_c".
5963-HINT: Truncate table "trunc_e" at the same time, or use TRUNCATE ... CASCADE.
6064+ERROR: "trunc_c" is referenced by foreign key from table "trunc_e"
65+ +HINT: truncate dependent tables at the same time or specify the CASCADE option
6166 TRUNCATE TABLE trunc_c,trunc_d,trunc_e; -- ok
6267 TRUNCATE TABLE trunc_c,trunc_d,trunc_e,truncate_a; -- fail
6368-ERROR: cannot truncate a table referenced in a foreign key constraint
6469-DETAIL: Table "trunc_b" references "truncate_a".
6570-HINT: Truncate table "trunc_b" at the same time, or use TRUNCATE ... CASCADE.
6671+ERROR: "truncate_a" is referenced by foreign key from table "trunc_b"
72+ +HINT: truncate dependent tables at the same time or specify the CASCADE option
6773 TRUNCATE TABLE trunc_c,trunc_d,trunc_e,truncate_a,trunc_b; -- ok
6874 TRUNCATE TABLE truncate_a RESTRICT; -- fail
6975-ERROR: cannot truncate a table referenced in a foreign key constraint
7076-DETAIL: Table "trunc_b" references "truncate_a".
7177-HINT: Truncate table "trunc_b" at the same time, or use TRUNCATE ... CASCADE.
7278+ERROR: "truncate_a" is referenced by foreign key from table "trunc_b"
79+ +HINT: truncate dependent tables at the same time or specify the CASCADE option
7380 TRUNCATE TABLE truncate_a CASCADE; -- ok
7481-NOTICE: truncate cascades to table "trunc_b"
7582-NOTICE: truncate cascades to table "trunc_e"
7683 -- circular references
7784 ALTER TABLE truncate_a ADD FOREIGN KEY (col1) REFERENCES trunc_c;
7885 -- Add some data to verify that truncating actually works ...
79- @@ -77,21 +64,13 @@
86+ @@ -77,21 +71,17 @@
8087 INSERT INTO trunc_d VALUES (1);
8188 INSERT INTO trunc_e VALUES (1,1);
8289 TRUNCATE TABLE trunc_c;
8390-ERROR: cannot truncate a table referenced in a foreign key constraint
8491-DETAIL: Table "truncate_a" references "trunc_c".
8592-HINT: Truncate table "truncate_a" at the same time, or use TRUNCATE ... CASCADE.
8693+ERROR: "trunc_c" is referenced by foreign key from table "truncate_a"
94+ +HINT: truncate dependent tables at the same time or specify the CASCADE option
8795 TRUNCATE TABLE trunc_c,truncate_a;
8896-ERROR: cannot truncate a table referenced in a foreign key constraint
8997-DETAIL: Table "trunc_d" references "trunc_c".
9098-HINT: Truncate table "trunc_d" at the same time, or use TRUNCATE ... CASCADE.
9199+ERROR: "truncate_a" is referenced by foreign key from table "trunc_b"
100+ +HINT: truncate dependent tables at the same time or specify the CASCADE option
92101 TRUNCATE TABLE trunc_c,truncate_a,trunc_d;
93102-ERROR: cannot truncate a table referenced in a foreign key constraint
94103-DETAIL: Table "trunc_e" references "trunc_c".
95104-HINT: Truncate table "trunc_e" at the same time, or use TRUNCATE ... CASCADE.
96105+ERROR: "truncate_a" is referenced by foreign key from table "trunc_b"
106+ +HINT: truncate dependent tables at the same time or specify the CASCADE option
97107 TRUNCATE TABLE trunc_c,truncate_a,trunc_d,trunc_e;
98108-ERROR: cannot truncate a table referenced in a foreign key constraint
99109-DETAIL: Table "trunc_b" references "truncate_a".
100110-HINT: Truncate table "trunc_b" at the same time, or use TRUNCATE ... CASCADE.
101111+ERROR: "truncate_a" is referenced by foreign key from table "trunc_b"
112+ +HINT: truncate dependent tables at the same time or specify the CASCADE option
102113 TRUNCATE TABLE trunc_c,truncate_a,trunc_d,trunc_e,trunc_b;
103114 -- Verify that truncating did actually work
104115 SELECT * FROM truncate_a
105- @@ -117,10 +96 ,6 @@
116+ @@ -117,10 +107 ,6 @@
106117 INSERT INTO trunc_d VALUES (1);
107118 INSERT INTO trunc_e VALUES (1,1);
108119 TRUNCATE TABLE trunc_c CASCADE; -- ok
@@ -113,7 +124,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/truncate.out --la
113124 SELECT * FROM truncate_a
114125 UNION ALL
115126 SELECT * FROM trunc_c
116- @@ -143,144 +118 ,103 @@
127+ @@ -143,144 +129 ,103 @@
117128 INSERT INTO trunc_f VALUES (1);
118129 INSERT INTO trunc_f VALUES (2);
119130 CREATE TABLE trunc_fa (col2a text) INHERITS (trunc_f);
@@ -300,7 +311,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/truncate.out --la
300311 -- Test ON TRUNCATE triggers
301312 CREATE TABLE trunc_trigger_test (f1 int, f2 text, f3 text);
302313 CREATE TABLE trunc_trigger_log (tgop text, tglevel text, tgwhen text,
303- @@ -294,12 +228 ,26 @@
314+ @@ -294,12 +239 ,26 @@
304315 return null;
305316 end;
306317 $$ LANGUAGE plpgsql;
@@ -327,7 +338,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/truncate.out --la
327338 SELECT count(*) as "Row count in test table" FROM trunc_trigger_test;
328339 Row count in test table
329340 -------------------------
330- @@ -319,12 +267 ,12 @@
341+ @@ -319,12 +278 ,12 @@
331342 (1 row)
332343
333344 SELECT * FROM trunc_trigger_log;
@@ -344,15 +355,15 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/truncate.out --la
344355 truncate trunc_trigger_log;
345356 -- same test with an after trigger
346357 INSERT INTO trunc_trigger_test VALUES(1, 'foo', 'bar'), (2, 'baz', 'quux');
347- @@ -332,6 +280 ,7 @@
358+ @@ -332,6 +291 ,7 @@
348359 AFTER TRUNCATE ON trunc_trigger_test
349360 FOR EACH STATEMENT
350361 EXECUTE PROCEDURE trunctrigger('after trigger truncate');
351362+ERROR: unknown function: trunctrigger()
352363 SELECT count(*) as "Row count in test table" FROM trunc_trigger_test;
353364 Row count in test table
354365 -------------------------
355- @@ -351,17 +300 ,18 @@
366+ @@ -351,17 +311 ,18 @@
356367 (1 row)
357368
358369 SELECT * FROM trunc_trigger_log;
@@ -376,7 +387,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/truncate.out --la
376387 id1 integer default nextval('truncate_a_id1'));
377388 ALTER SEQUENCE truncate_a_id1 OWNED BY truncate_a.id1;
378389 INSERT INTO truncate_a DEFAULT VALUES;
379- @@ -384,14 +334 ,20 @@
390+ @@ -384,14 +345 ,20 @@
380391 (2 rows)
381392
382393 TRUNCATE truncate_a RESTART IDENTITY;
@@ -400,7 +411,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/truncate.out --la
400411
401412 CREATE TABLE truncate_b (id int GENERATED ALWAYS AS IDENTITY (START WITH 44));
402413 INSERT INTO truncate_b DEFAULT VALUES;
403- @@ -414,56 +370 ,74 @@
414+ @@ -414,56 +381 ,74 @@
404415 (2 rows)
405416
406417 TRUNCATE truncate_b RESTART IDENTITY;
@@ -492,15 +503,15 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/truncate.out --la
492503 -- foreign key on partitioned table: partition key is referencing column.
493504 -- Make sure truncate did execute on all tables
494505 CREATE FUNCTION tp_ins_data() RETURNS void LANGUAGE plpgsql AS $$
495- @@ -472,6 +446 ,7 @@
506+ @@ -472,6 +457 ,7 @@
496507 INSERT INTO truncpart VALUES (1), (100), (150);
497508 END
498509 $$;
499510+ERROR: relation "truncprim" does not exist
500511 CREATE FUNCTION tp_chk_data(OUT pktb regclass, OUT pkval int, OUT fktb regclass, OUT fkval int)
501512 RETURNS SETOF record LANGUAGE plpgsql AS $$
502513 BEGIN
503- @@ -481,114 +456 ,158 @@
514+ @@ -481,114 +467 ,158 @@
504515 ORDER BY 2, 4;
505516 END
506517 $$;
0 commit comments