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

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to