Thread: Truncate
# Disallow TRUNCATE on tables that are involved in referential constraints The issue with finding and removing foreign key constraints is no longer an issue, so please apply the attached. It does NOT check for rules or on delete triggers (old style foreign keys) as those are difficult to deal with (remove, truncate, re-add). Please add files: src/test/regress/expected/truncate.out src/test/regress/sql/truncate.sql
Attachment
Rod Taylor <rbt@zort.ca> writes: > The issue with finding and removing foreign key constraints is no longer > an issue, so please apply the attached. I do not like adding a system-table index just for the convenience of this one not-very-time-critical function. Please rewrite the patch without that. BTW, if you are only reading the table and not writing it, the correct lock type to get is AccessShareLock, not RowExclusiveLock. regards, tom lane
On Tue, 2002-08-20 at 10:21, Tom Lane wrote: > Rod Taylor <rbt@zort.ca> writes: > > The issue with finding and removing foreign key constraints is no longer > > an issue, so please apply the attached. > > I do not like adding a system-table index just for the convenience of > this one not-very-time-critical function. Please rewrite the patch > without that. > BTW, if you are only reading the table and not writing it, the correct > lock type to get is AccessShareLock, not RowExclusiveLock. Corrected both of the above.
Attachment
Rod Taylor <rbt@zort.ca> writes: > Corrected both of the above. Revised patch looks okay in a quick eyeball... regards, tom lane
Your patch has been added to the PostgreSQL unapplied patches list at: http://candle.pha.pa.us/cgi-bin/pgpatches I will try to apply it within the next 48 hours. --------------------------------------------------------------------------- Rod Taylor wrote: > On Tue, 2002-08-20 at 10:21, Tom Lane wrote: > > Rod Taylor <rbt@zort.ca> writes: > > > The issue with finding and removing foreign key constraints is no longer > > > an issue, so please apply the attached. > > > > I do not like adding a system-table index just for the convenience of > > this one not-very-time-critical function. Please rewrite the patch > > without that. > > > BTW, if you are only reading the table and not writing it, the correct > > lock type to get is AccessShareLock, not RowExclusiveLock. > > Corrected both of the above. > [ Attachment, skipping... ] [ Attachment, skipping... ] [ Attachment, skipping... ] > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073
Patch applied. Thanks. --------------------------------------------------------------------------- Rod Taylor wrote: > On Tue, 2002-08-20 at 10:21, Tom Lane wrote: > > Rod Taylor <rbt@zort.ca> writes: > > > The issue with finding and removing foreign key constraints is no longer > > > an issue, so please apply the attached. > > > > I do not like adding a system-table index just for the convenience of > > this one not-very-time-critical function. Please rewrite the patch > > without that. > > > BTW, if you are only reading the table and not writing it, the correct > > lock type to get is AccessShareLock, not RowExclusiveLock. > > Corrected both of the above. > [ Attachment, skipping... ] [ Attachment, skipping... ] [ Attachment, skipping... ] > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073