Re: UPDATE crash in HEAD and 8.1

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: UPDATE crash in HEAD and 8.1
Дата
Msg-id 20060620180313.GW26882@surnet.cl
обсуждение исходный текст
Ответ на Re: UPDATE crash in HEAD and 8.1  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: UPDATE crash in HEAD and 8.1
Re: UPDATE crash in HEAD and 8.1
Список pgsql-hackers
Tom Lane wrote:
> Alvaro Herrera <alvherre@commandprompt.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.

Yeah, I agree we should disallow it.  For the curious, the bizarre behavior
is

alvherre=# update pk set id = count(id) ;
ERROR:  ctid is NULL
alvherre=# update pk set id = sum(id) ;
ERROR:  ctid is NULL

Clearly not a very useful error message.

> 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.

I refrain -- tried following it but I don't know that code at all.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: UPDATE crash in HEAD and 8.1
Следующее
От: Wade Klaver
Дата:
Сообщение: Re: Initdb segfaults during "initializing pg_authid"