Thread: BUG #4515: UPDATE strange behavior

BUG #4515: UPDATE strange behavior

From
"xtron"
Date:
The following bug has been logged online:

Bug reference:      4515
Logged by:          xtron
Email address:      xtronz@yandex.ru
PostgreSQL version: 8.3.5
Operating system:   Debian GNU/Linux
Description:        UPDATE strange behavior
Details:

IMHO this is strange behavior:

create table a1(id int, value int);
create table a2(id int, value int);

this is work:
update a1 set value = a2.value from a2 where a1.id = a2.id;

this is NOT work:
update a1 set a1.value = a2.value from a2 where a1.id = a2.id;

Re: BUG #4515: UPDATE strange behavior

From
Tom Lane
Date:
"xtron" <xtronz@yandex.ru> writes:
> this is NOT work:
> update a1 set a1.value = a2.value from a2 where a1.id = a2.id;

This syntax is disallowed by the SQL standard: a SET target is just the
name of the column.  If we tried to interpret it as you suggest then
we'd be incompatible for composite-type columns.

            regards, tom lane