Re: MySQL/PostgreSQL discrepancy

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Ken Smith <ken(at)turbolinux(dot)co(dot)jp>
Cc: pgsql-bugs(at)postgreSQL(dot)org
Subject: Re: MySQL/PostgreSQL discrepancy
Date: 2000-10-28 04:21:07
Message-ID: Pine.BSF.4.10.10010272117290.36339-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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."

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2000-10-28 04:39:53 Re: MySQL/PostgreSQL discrepancy
Previous Message Tom Lane 2000-10-28 00:50:37 Re: Problem with group by command