RE: Rule/currval() issue

Поиск
Список
Период
Сортировка
От Creager, Robert S
Тема RE: Rule/currval() issue
Дата
Msg-id 10FE17AD5F7ED31188CE002048406DE8514D00@lsv-msg06.stortek.com
обсуждение исходный текст
Ответ на Rule/currval() issue  (Tim Perdue <tim@perdue.net>)
Ответы Re: Rule/currval() issue  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-sql
Tom,

You indicate trigger, rather than rule.  Going by Momjian's book, he
indicates that rules are "...ideal for when the action affects other
tables."  Can you clarify why you would use a trigger for this?  I'm asking
because I have no clue how to use rules or triggers, but need one or the
other to modify a second table on inserts/deletes to the first table.  I'd
like to make the best choice first if possible.

Thanks,
Rob

> -----Original Message-----
> From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
> Sent: Wednesday, March 14, 2001 11:09 AM
> To: Tim Perdue
> Cc: pgsql-sql@postgresql.org
> Subject: Re: [SQL] Rule/currval() issue 
> 
> 
> Tim Perdue <tim@perdue.net> writes:
> > This is related to the plpgsql project I was working on 
> this morning. I'm
> > trying to create a rule, so that when a row is inserted 
> into a certain table,
> > we also create a row over in a "counter table". The problem 
> lies in getting
> > the primary key value (from the sequence) so it can be 
> inserted in that
> > related table.
> 
> You probably should be using a trigger, not a rule at all.
> 
>             regards, tom lane
> 
> ---------------------------(end of 
> broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to 
> majordomo@postgresql.org)
> 


В списке pgsql-sql по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Rule/currval() issue
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Rule/currval() issue