Re: MySQL/PostgreSQL discrepancy - Mailing list pgsql-bugs

From Stephan Szabo
Subject Re: MySQL/PostgreSQL discrepancy
Date
Msg-id Pine.BSF.4.10.10010272117290.36339-100000@megazone23.bigpanda.com
Whole thread Raw
In response to MySQL/PostgreSQL discrepancy  (Ken Smith <ken@turbolinux.co.jp>)
List pgsql-bugs
> THE TEST
> Run 'psql', then enter the following except for the select statement
> output.
>
> ---BEGIN---
> create table test (name char, a int, b int);
> insert into test values ('x', 1, 2);
> select * from test;
> update test set a=3,b=a where name='x';
> insert into test values ('y', 1, 2);
> update test set b=a,a=3 where name='y';
> select * from test;
>  name | a | b
> ------+---+---
>  x    | 3 | 1
>  y    | 3 | 1
> drop table test;
> ---END---
>
> I am used to MySQL so I expected the following from the select
> statement.
>  name | a | b
> ------+---+---
>  x    | 3 | 3
>  y    | 3 | 1
>
> Which behavior is the correct?

I believe ours...
From update positioned:
"The <value expression>s are effecitvely evaluated before
updating the object row.  If a <value expression> contains a
reference to a column of T, then the reference is to the value
of that column in the object row before any value of the object
row is updated."

From update searched:
"The <value expressions> are effectively evaluated for each row
 of T before updating any row of T."

pgsql-bugs by date:

Previous
From: Philip Warner
Date:
Subject: Re: MySQL/PostgreSQL discrepancy
Next
From: Thomas Lockhart
Date:
Subject: Re: PL/pgSQL functions: NULL parameter trouble