Re: BUG #6048: TRUNCATE vs TRUNCATE CASCADE: misleading message
От | Artiom Makarov |
---|---|
Тема | Re: BUG #6048: TRUNCATE vs TRUNCATE CASCADE: misleading message |
Дата | |
Msg-id | BANLkTi=y_nxJ1WC_E-snGa+Oh5BgEZwZPg@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: BUG #6048: TRUNCATE vs TRUNCATE CASCADE: misleading message (Robert Haas <robertmhaas@gmail.com>) |
Список | pgsql-bugs |
2011/6/2 Robert Haas <robertmhaas@gmail.com>: > > It's a fairly unusual case to have two inheritance children one of > which has a foreign key referencing the other, and to then try to BTW, when the both tables refer to tr_test1 directly the same thing happens on truncating: create table tr_test1(id1 int, primary key(id1)); create table tr_test2(id2 int, id int, primary key(id2), foreign key (id) references tr_test1(id1) MATCH SIMPLE ON UPDATE RESTRICT ON DELETE RESTRICT); create table tr_test3(id3 int, id int, primary key(id3), foreign key (id) references tr_test1(id1) MATCH SIMPLE ON UPDATE RESTRICT ON DELETE RESTRICT); insert into tr_test1(id1) values (1); insert into tr_test2(id2,id) values (1,1); insert into tr_test2(id2,id) values (2,1); insert into tr_test3(id3,id) values (1,1); truncate tr_test1; -- No message about tr_test3 ! __ERROR: cannot truncate a table referenced in a foreign key constraint __SQL state: 0A000 __Detail: Table "tr_test2" references "tr_test1". __Hint: Truncate table "tr_test2" at the same time, or use TRUNCATE ... CASCADE. truncate tr_test1 cascade; __NOTICE: truncate cascades to table "tr_test2" __NOTICE: truncate cascades to table "tr_test3" __Query returned successfully with no result in 94 ms. No message about tr_test3 !
В списке pgsql-bugs по дате отправления: