Re: [SQL] Help with trigger that updates a row prior to a potentially aborted deletion?

2006-03-03 Thread Andrew Sullivan
On Fri, Mar 03, 2006 at 12:19:22AM -, Simon Kinsella wrote: > Hi Andrew, > > I think I may have cracked this problem by combining a RULE ON DELETE which > calls a function instead of the standard DELETE op. No triggers. It was a Ah. Yes, likely. Yeah, you can't do that. A -- Andrew Sull

Re: [SQL] Help with trigger that updates a row prior to a potentially aborted deletion?

2006-03-02 Thread Simon Kinsella
Sent: Thursday, March 02, 2006 12:20 PM To: pgsql-sql@postgresql.org Subject: Re: [SQL] Help with trigger that updates a row prior to a potentially aborted deletion? On Wed, Mar 01, 2006 at 08:41:20PM -, Simon Kinsella wrote: > Ok thanks, will check this out. Is that the same as savepoint

Re: [SQL] Help with trigger that updates a row prior to a potentially aborted deletion?

2006-03-02 Thread Andrew Sullivan
On Wed, Mar 01, 2006 at 08:41:20PM -, Simon Kinsella wrote: > Ok thanks, will check this out. Is that the same as savepoints, or something > different? (am using 8.1.2) Yes, same thing. > At the moment I'm investigating using a rule (rewrite the DELETE as an > UPDATE to set the flag, then use

Re: [SQL] Help with trigger that updates a row prior to a potentially aborted deletion?

2006-03-01 Thread Simon Kinsella
re if it's going to work but if so I'll post back. Thanks! Simon -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Andrew Sullivan Sent: Wednesday, March 01, 2006 6:24 PM To: pgsql-sql@postgresql.org Subject: Re: [SQL] Help with trigger that updates

Re: [SQL] Help with trigger that updates a row prior to a potentially aborted deletion?

2006-03-01 Thread Andrew Sullivan
On Wed, Mar 01, 2006 at 01:30:23PM -, Simon Kinsella wrote: > I'm trying to achieve this with a BEFORE DELETE trigger, which would set the > 'marked_for_deletion' field to TRUE before attempting the delete proper. > Then if the DELETE fails the row would still be tagged and I'd be happy. > Prob

Re: [SQL] Help with trigger that updates a row prior to a potentially aborted deletion?

2006-03-01 Thread Simon Kinsella
Simon Kinsella Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] Help with trigger that updates a row prior to a potentially aborted deletion? On Wed, 1 Mar 2006, Simon Kinsella wrote: > Hi all, > > I have a situation where a DELETE operation may (correctly) fail due > to a RESTRICT FK

Re: [SQL] Help with trigger that updates a row prior to a potentially

2006-03-01 Thread Stephan Szabo
On Wed, 1 Mar 2006, Simon Kinsella wrote: > Hi all, > > I have a situation where a DELETE operation may (correctly) fail due to a > RESTRICT FK constraint. If so, I need to set a flag in the row indicating > that it has been marked for deletion so that I can disregarded in subsequent > queries. >

Re: [SQL] Help with trigger that updates a row prior to a potentially aborted deletion?

2006-03-01 Thread Simon Kinsella
Hello Achilleus Thanks for your feedback. On changing the return to NULL: According to the docs, if I return NULL in the BEFORE trigger itself, all subsequent triggers and the row-level op itself (the actual delete) will be skipped completely, which is no good. I will confirm this to make sure tho

[SQL] Help with trigger that updates a row prior to a potentially aborted deletion?

2006-03-01 Thread Simon Kinsella
Hi all, I have a situation where a DELETE operation may (correctly) fail due to a RESTRICT FK constraint. If so, I need to set a flag in the row indicating that it has been marked for deletion so that I can disregarded in subsequent queries. I'm trying to achieve this with a BEFORE DELETE trigger

Re: [SQL] help with trigger

2004-08-27 Thread Dino Vliet
Maybe I've missed it but can someone plese help me with this? Brgds and thanks in advance, --- Dino Vliet <[EMAIL PROTECTED]> wrote: > Hi folks, > I'm new to PostgreSQL and am busy tring to work with > it. Of pl/pgsql I know even less and that's the part > I > have a question on right now. I hav