Unix Technical Forum

Re: how to create rule as on delete

This is a discussion on Re: how to create rule as on delete within the pgsql Sql forums, part of the PostgreSQL category; --> I think you want a delete trigger which does your insert and then follows through with the delete by ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Sql

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-19-2008, 12:52 PM
elein
 
Posts: n/a
Default Re: how to create rule as on delete

I think you want a delete trigger which does your
insert and then follows through with the delete
by returning old.

--elein
elein@varlena.com

On Tue, Oct 18, 2005 at 09:43:34PM -0700, efa din wrote:
> This is my rule for doing the delete event. The rule
> can be created. But the problem is, after the record
> has been deleted from the 'mytable', this record
> cannot be inserted into table 'maytable_log'.
>
> CREATE RULE on_delete AS ON DELETE TO mytable DO
> INSERT INTO mytable_log values (old.id,old.name);
>
>
>
> 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.
>
> CREATE RULE on_delete AS ON DELETE TO mytable DO
> INSTEAD INSERT INTO mytable_log values
> (old.id,old.name);
>
> 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
>
>
>
>
>
>
> __________________________________
> Yahoo! Mail - PC Magazine Editors' Choice 2005
> http://mail.yahoo.com
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>


---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 11:22 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com