Parser bug results in ambiguous errors/behaviour

Поиск
Список
Период
Сортировка
От Gavin Sherry
Тема Parser bug results in ambiguous errors/behaviour
Дата
Msg-id Pine.LNX.4.58.0509221647150.25615@linuxworld.com.au
обсуждение исходный текст
Ответы Re: Parser bug results in ambiguous errors/behaviour  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hi,

A bug/short coming in the parser leads to some pretty ambiguous errors
and/or foot shooting. Consider the following:

template1=# create table foo(i int, b bool, t text);
CREATE TABLE
template1=# insert into foo values(1, 'f', 'foo');
INSERT 0 1
template1=# update foo set i=2,b='t' and t='bar' where i=1;
UPDATE 1

Now there's an error in the SQL: "b='t' AND t='bar'". We don't detect
this. Result:

template1=# select * from foo;i | b |  t
---+---+-----2 | f | foo
(1 row)


It gets more interesting:

template1=# update foo set b='t', i=2 and t='bar' where i=1;
ERROR:  argument of AND must be type boolean, not type integer

Now, obviously the SQL is invalid but I think we should detect it. This
happens in HEAD, 8.0 and 7.2 -- and I presume other releases.

Comments?

Thanks,

Gavin


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

Предыдущее
От: David Fetter
Дата:
Сообщение: Re: Minimally avoiding Transaction Wraparound in VLDBs
Следующее
От: Michael Glaesemann
Дата:
Сообщение: Re: Minimally avoiding Transaction Wraparound in VLDBs