Re: SQL-spec incompatibilities in similar_escape() and related stuff

Поиск
Список
Период
Сортировка
От Andrew Gierth
Тема Re: SQL-spec incompatibilities in similar_escape() and related stuff
Дата
Msg-id 87d0kmfbpq.fsf@news-spur.riddles.org.uk
обсуждение исходный текст
Ответ на Re: SQL-spec incompatibilities in similar_escape() and related stuff  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: SQL-spec incompatibilities in similar_escape() and related stuff  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
>>>>> "Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes:

 Tom> Hmm.  Oddly, you can't fix it by adding parens:

 Tom> regression=# select 'foo' similar to ('f' || escape) escape escape from (values ('oo')) v(escape);
 Tom> psql: ERROR:  syntax error at or near "escape"
 Tom> LINE 1: select 'foo' similar to ('f' || escape) escape escape from (...
 Tom>                                         ^

 Tom> Since "escape" is an unreserved word, I'd have expected that to
 Tom> work. Odd.

Simpler cases fail too:

select 'f' || escape from (values ('o')) v(escape);
psql: ERROR:  syntax error at or near "escape"

select 1 + escape from (values (1)) v(escape);  -- works
select 1 & escape from (values (1)) v(escape);  -- fails

in short ESCAPE can't follow any generic operator, because its lower
precedence forces the operator to be reduced as a postfix op instead.

 Tom> The big picture here is that fixing grammar ambiguities by adding
 Tom> precedence is a dangerous business :-(

Yeah. But the alternative is usually reserving words more strictly,
which has its own issues :-(

Or we could kill off postfix operators...

-- 
Andrew (irc:RhodiumToad)



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: PANIC :Call AbortTransaction when transaction id is no normal
Следующее
От: Peter Geoghegan
Дата:
Сообщение: Re: What is an item pointer, anyway?