Andrew McMillan <andrew(at)catalyst(dot)net(dot)nz> writes:
> Tom Lane wrote:
>> Could we get away with restricting INSERT RETURNING to work only on
>> inserts directly to tables (no ON INSERT DO INSTEAD allowed)? Or is
>> that too much of a kluge?
> Isn't it likely that the person writing the RULE would want to
> internally use an INSERT ... RETURNING query and that the RETURNS
> ... should either use values from that, or use a SELECT clause keyed
> on values from that?
Hmm, so we'd allow INSERT RETURNING to be the last statement of an
ON INSERT DO INSTEAD rule, and the RETURNING clause would either be
dropped (if rewriting a plain INSERT) or used to form the outputs
(if rewriting INSERT RETURNING). Kind of limited maybe, but it would
work for simple cases, which is a lot better than none at all...
The trouble with INSERT RETURNING followed by SELECT is that a rule
has noplace to keep the results: it hasn't got any local variables.
(And I don't think I want to invent such a feature, at least not on
the spur of the moment.)
regards, tom lane
In response to
pgsql-hackers by date
|Next:||From: Christopher Kings-Lynne||Date: 2001-07-23 02:01:36|
|Subject: RE: More ADD CONSTRAINT behaviour questions|
|Previous:||From: mlw||Date: 2001-07-22 18:30:15|
|Subject: Re: sub queries and caching.|