Re: A small bug in gram.y

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема Re: A small bug in gram.y
Дата
Msg-id 4AEFE07D.7080009@enterprisedb.com
обсуждение исходный текст
Ответ на Re: A small bug in gram.y  (Gokulakannan Somasundaram <gokul007@gmail.com>)
Ответы Re: A small bug in gram.y
Re: A small bug in gram.y
Список pgsql-hackers
Gokulakannan Somasundaram wrote:
> Hmmm.... no-one else feels this as a bug????
> 
> The logic is that a function call is made for "similar" and the position
> where SIMILAR occurs is at the third position, but it has been coded that it
> is at fifth position.

The function call is constructed for the similar_escape function, to
construct a regular expression equivalent to the right operand of the
SIMILAR TO. So setting the error location to the right operand seems OK
to me.

However, I note that for the "a_expr SIMILAR TO a_expr" rule we're doing
what you expected and the error location points to SIMILAR. I think we
should change that to behave like NOT SIMILAR TO.

Here's an example that exercises those paths:

postgres=# SELECT 'aa' NOT SIMILAR TO 123;
ERROR:  function pg_catalog.similar_escape(integer, unknown) does not exist
LINE 1: SELECT 'aa' NOT SIMILAR TO 123;                                  ^
HINT:  No function matches the given name and argument types. You might
need to add explicit type casts.
postgres=# SELECT 'aa' SIMILAR TO 123;
ERROR:  function pg_catalog.similar_escape(integer, unknown) does not exist
LINE 1: SELECT 'aa' SIMILAR TO 123;                   ^
HINT:  No function matches the given name and argument types. You might
need to add explicit type casts.
postgres=#

I think the former error location is better.

--  Heikki Linnakangas EnterpriseDB   http://www.enterprisedb.com


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

Предыдущее
От: Gokulakannan Somasundaram
Дата:
Сообщение: Re: A small bug in gram.y
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: Segfault in PL/Python