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