Re: BUG #2303: UPDATE from manual is incorrect - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #2303: UPDATE from manual is incorrect
Date
Msg-id 18631.1141858198@sss.pgh.pa.us
Whole thread Raw
In response to BUG #2303: UPDATE from manual is incorrect  ("Massimo Fidanza" <malix0@gmail.com>)
Responses Re: BUG #2303: UPDATE from manual is incorrect
List pgsql-bugs
"Massimo Fidanza" <malix0@gmail.com> writes:
> The query is the last but one

> UPDATE employees SET last_closed_deal = deal.id
>     FROM accounts JOIN deals ON (account.id = deal.account_id)
>     WHERE deal.employee_id = employees.id
>     AND deal.name = 'Rocket Powered Skates'
>     AND accounts.name = '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

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #2308: pg_dump -a does not respect referential dependencies
Next
From: Tom Lane
Date:
Subject: Re: BUG #2303: UPDATE from manual is incorrect