Re: how to create rule as on delete - Mailing list pgsql-sql

From Stewart Ben (RBAU/EQS4) *
Subject Re: how to create rule as on delete
Date
Msg-id E253BDD7F008244585AEE87AF8F0224F116C7B16@cl-mail01.au.bosch.com
Whole thread Raw
In response to how to create rule as on delete  (efa din <efa_din80@yahoo.com>)
List pgsql-sql
> If I add the DO INSTEAD,the record can be inserted
> into 'maytable_log' and also still remain in the table
> 'maytable'. Which is exactly not exist at all. It just
> show it as im using the DO INSTEAD.
>
> My problem is, how to insert the deleted record into
> table 'mytable_log' without showing it in table
> 'maytable'. I really need the solution..please

Add a DELETE clause on the table 'maytable' as part of the DO INSTEAD,
after the INSERT INTO.

Or, IIRC, you could INSERT INTO (without the DO INSTEAD) with the
variable NEW - the NEW variable will store the row being deleted.

Best regards,

Ben Stewart

--
Robert Bosch (Australia) Pty. Ltd.
Engineering Quality Services, Student Software Engineer (RBAU/EQS4)
Locked Bag 66 - Clayton South, VIC 3169 - AUSTRALIA
Tel: +61 3 9541-7002 Fax: +61 3 9541-7700
mailto:ben.stewart@au.bosch.com
http://www.bosch.com.au/


pgsql-sql by date:

Previous
From: "Stewart Ben (RBAU/EQS4) *"
Date:
Subject: Re: automatic update or insert
Next
From: Michael Glaesemann
Date:
Subject: Re: SQL language