Re: Dyamic updates of NEW with pl/pgsql - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Dyamic updates of NEW with pl/pgsql
Date
Msg-id 603c8f071003121441l607ef9fcoac665e3a7ebe028@mail.gmail.com
Whole thread Raw
In response to Re: Dyamic updates of NEW with pl/pgsql  (Boszormenyi Zoltan <zb@cybertec.at>)
List pgsql-hackers
On Fri, Mar 12, 2010 at 4:24 PM, Boszormenyi Zoltan <zb@cybertec.at> wrote:
> Merlin Moncure írta:
>> On Fri, Mar 12, 2010 at 3:01 PM, Boszormenyi Zoltan <zb@cybertec.at> wrote:
>>
>>> What's wrong with "UPDATE foo SET (foo) = (NEW);" ?
>>>
>>>
>>
>> amen brother! :-)
>>
>> I say though, since you can do:
>> SELECT foo FROM foo;
>> why not
>> UPDATE foo SET foo = new;?
>>
>
> I just tried this:
>
> zozo=# create table foo (foo integer, bar integer);
> CREATE TABLE
> zozo=# insert into foo values (1, 2), (2, 4);
> INSERT 0 2
> zozo=# select foo from foo;
>  foo
> -----
>   1
>   2
> (2 rows)

But you can always get around this with, e.g.

SELECT v FROM foo v;

...Robert


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Reposnse from backend when wrong user/database request send
Next
From: Alvaro Herrera
Date:
Subject: Re: buildfarm logging versus embedded nulls