pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: elein <elein@varlena.com>
To: efa din <efa_din80@yahoo.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: how to create rule as on delete
Date: Mon, 24 Oct 2005 20:08:37 -0700
Message-ID: <20051025030836.GW30170@varlena.com> (raw)
In-Reply-To: <20051019044334.51090.qmail@web33302.mail.mud.yahoo.com>
References: <20051019044334.51090.qmail@web33302.mail.mud.yahoo.com>

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
> 



view thread (3+ messages)

Message-ID: <20051025030836.GW30170@varlena.com>
Permalink:  ../20051025030836.GW30170@varlena.com/
Also on:    postgresql.org/message-id/20051025030836.GW30170@varlena.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: elein@varlena.com, efa_din80@yahoo.com
  Subject: Re: how to create rule as on delete
  In-Reply-To: <20051025030836.GW30170@varlena.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox