Re: Rules: A Modest Proposal
От | Martijn van Oosterhout |
---|---|
Тема | Re: Rules: A Modest Proposal |
Дата | |
Msg-id | 20091005140916.GB1518@svana.org обсуждение исходный текст |
Ответ на | Re: Rules: A Modest Proposal (Andrew Gierth <andrew@tao11.riddles.org.uk>) |
Ответы |
Re: Rules: A Modest Proposal
|
Список | pgsql-hackers |
On Mon, Oct 05, 2009 at 02:53:56PM +0100, Andrew Gierth wrote: > Here are a couple of the more common ones: > > 1) any reference in an insert rule to NEW.col where col has a volatile > default, or the expression in the insert statement was volatile, or > the expression's value is changed by the insert, will do the wrong > thing: ISTM it may be possible to use the new WITH construct here. So the rule evaluation for the following > create table t (a integer); > create table t_log (a integer); > create rule t_ins AS ON insert TO t do also insert into t_log values (NEW.a); > insert into t values (floor(random()*1000)::integer); becomes something like: WITH NEW AS ( insert into t values (floor(random()*1000)::integer); RETURNING * ) insert into t_log values (NEW.a); Would this not have the required semantics? Have a nice day, -- Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/ > Please line up in a tree and maintain the heap invariant while > boarding. Thank you for flying nlogn airlines.
В списке pgsql-hackers по дате отправления: