strk írta:
> On Fri, Mar 12, 2010 at 10:47:45AM -0800, David Fetter wrote:
>
>> On Fri, Mar 12, 2010 at 07:35:41PM +0100, Pavel Stehule wrote:
>>
>>> 2010/3/12 David Fetter <david@fetter.org>:
>>>
>>>> This is, by the way, an excellent argument for including hstore in
>>>> core in 9.1. :)
>>>>
>>> I like it - but it looking little bit strange - I thinking we need
>>> only one function (maybe with some special support from pl executor)
>>>
>>> begin
>>> update_field(NEW, 'field', value);
>>> ....
>>>
>> This doesn't seem like a terribly useful addition, it being specific
>> to PL/pgsql. Then there's the quoting issue, which the above doesn't
>> quite address. Putting hstore in would let all the other PLs use it,
>> to the extent that they need such a thing. :)
>>
>
> Plus pure SQL use !
>
What's wrong with "UPDATE foo SET (foo) = (NEW);" ?
I know it's a little ambiguous, as table "foo" can have fields
named "foo" and "new", but the UPDATE foo SET (field, ...) = (value, ...);
works in plain SQL and the (...) usually denotes a list with
more than one field/value. pl/pgSQL could treat the
"list with single name" as a special case (maybe checking
whether the table has fields "foo", "new" and/or "old" and
issue a warning when relevant) and treat the above as a
whole-row update.
Best regards,
Zoltán Böszörményi
--
Bible has answers for everything. Proof:
"But let your communication be, Yea, yea; Nay, nay: for whatsoever is more
than these cometh of evil." (Matthew 5:37) - basics of digital technology.
"May your kingdom come" - superficial description of plate tectonics
----------------------------------
Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH
http://www.postgresql.at/