Re: [GENERAL] Delete all records NOT referenced by Foreign Keys

2003-12-14 Thread Stephan Szabo
On Sun, 14 Dec 2003, D. Dante Lorenso wrote: > PG already can block a delete when it knows that foreign key exists, so > why can't I perform a query that says... > > DELETE FROM tablename > WHERE FOREIGN_KEY_EXISTS(oid) IS FALSE; That's fairly different from the checks that are performed

Re: [GENERAL] Delete all records NOT referenced by Foreign Keys

2003-12-14 Thread D. Dante Lorenso
Martijn van Oosterhout wrote: On Sat, Dec 13, 2003 at 09:48:16PM -0600, D. Dante Lorenso wrote: This is something very ugly indeed and is what I'll have to resort to unless I can find something cleaner. Ideally, I would be able to run this cleanup on a subset of the table data after an insert

Re: [GENERAL] Delete all records NOT referenced by Foreign Keys

2003-12-13 Thread Martijn van Oosterhout
On Sat, Dec 13, 2003 at 09:48:16PM -0600, D. Dante Lorenso wrote: > This is something very ugly indeed and is what I'll have to resort to unless > I can find something cleaner. Ideally, I would be able to run this cleanup > on a subset of the table data after an insert into the table. I would lik

Re: [GENERAL] Delete all records NOT referenced by Foreign Keys

2003-12-13 Thread D. Dante Lorenso
Bruno Wolff III wrote: On Sat, Dec 13, 2003 at 02:20:15 -0600, "D. Dante Lorenso" <[EMAIL PROTECTED]> wrote: I'd like to run a clean up command on my tables to eliminate rows that I'm no longer using in the database. I want to do something like this: DELETE FROM tablename WHERE IS_REFEREN

Re: [GENERAL] Delete all records NOT referenced by Foreign Keys

2003-12-13 Thread Bruno Wolff III
On Sat, Dec 13, 2003 at 02:20:15 -0600, "D. Dante Lorenso" <[EMAIL PROTECTED]> wrote: > I'd like to run a clean up command on my tables to > eliminate rows that I'm no longer using in the database. > > I want to do something like this: > >DELETE FROM tablename >WHERE IS_REFERENCED_BY_FO