Re: Alias hstore's ? to ~ so that it works with JDBC - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Alias hstore's ? to ~ so that it works with JDBC
Date
Msg-id 23349.1360603850@sss.pgh.pa.us
Whole thread Raw
In response to Re: Alias hstore's ? to ~ so that it works with JDBC  (Vladimir Sitnikov <sitnikov.vladimir@gmail.com>)
Responses Re: Alias hstore's ? to ~ so that it works with JDBC  (Seamus Abshere <seamus@abshere.net>)
List pgsql-hackers
Vladimir Sitnikov <sitnikov.vladimir@gmail.com> writes:
> The thing is PostgeSQL JDBC driver should be able to parse sql in order to
> tell if specific question mark is a bind variable or it is inside string
> literal, or it is inside of some comment.

What's your point?  Those cases don't have anything to do with variables
versus operators, neither of which would be inside a literal or comment.

It would take extremely deep knowledge of SQL syntax for the driver to
reliably tell the difference between a variable and an operator --- and
even then, I'm not sure it'd be terribly user-friendly, because the
parsing would depend on details like where there is whitespace.  For
instance, the backend parser would think that "?= 2" is a prefix
operator named "?=" followed by literal 2, whereas "? = 2" will be
parsed differently, and "? ? 2" yet differently (because "=" is
special-cased but an operator named "?" isn't).  I'm not sure it'd be
any more usable to work like that than with an explicit escaping
convention.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Vladimir Sitnikov
Date:
Subject: Re: Alias hstore's ? to ~ so that it works with JDBC
Next
From: Seamus Abshere
Date:
Subject: Re: Alias hstore's ? to ~ so that it works with JDBC