Skip site navigation (1) Skip section navigation (2)

Re: BUG #2303: UPDATE from manual is incorrect

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Massimo Fidanza" <malix0(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2303: UPDATE from manual is incorrect
Date: 2006-03-08 22:49:58
Message-ID: (view raw or whole thread)
Lists: pgsql-bugs
"Massimo Fidanza" <malix0(at)gmail(dot)com> writes:
> The query is the last but one

> UPDATE employees SET last_closed_deal =
>     FROM accounts JOIN deals ON ( = deal.account_id)
>     WHERE deal.employee_id =
>     AND = 'Rocket Powered Skates'
>     AND = 'Acme Corporation'
>     ORDER BY deal.signed_date DESC LIMIT 1;

> this query is not correct and doesn't work with postgresql 8.1.

It still works, if you enable add_missing_from.  But I agree that the
example shouldn't assume that.

> My query that doesn't work is the first and I modify it in second form that
> is the correct one.

That appears to be an entirely unrelated issue, which is whether
aggregates in the SET list of an UPDATE make any sense.  I'm inclined
to think not --- what are you aggregating over?

			regards, tom lane

In response to


pgsql-bugs by date

Next:From: Tom LaneDate: 2006-03-08 23:01:49
Subject: Re: BUG #2303: UPDATE from manual is incorrect
Previous:From: Tom LaneDate: 2006-03-08 22:37:08
Subject: Re: BUG #2308: pg_dump -a does not respect referential dependencies

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group