Re: UPDATE crash in HEAD and 8.1

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: UPDATE crash in HEAD and 8.1
Date: 2006-06-20 17:36:14
Message-ID: 24790.1150824974@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> update pk set id = max(id) + 2;

I'm fairly sure this query is illegal per spec. There are ancient
discussions in the archives about whether aggregates in an UPDATE target
list can have a consistent interpretation or not. We never found one,
but never got around to disallowing it either. Maybe it's time. If you
try it with something like sum() you don't get a crash, but you do get
rather bizarre behavior.

Having said that, this may well expose a bug in the MAX-optimization
code that has consequences for more useful queries. I'll take a look
later today if no one beats me to it.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2006-06-20 17:42:11 Re: Some small code-restructuring issues
Previous Message Andrew Dunstan 2006-06-20 17:35:50 Re: Slightly bogus regression test for contrib/dblink