Postgres uses ? as an operator; may its JDBC driver allow escaping?
Mark Rotteveel
mark at lawinegevaar.nl
Tue Feb 12 11:56:30 PST 2013
On 12-2-2013 12:39, Lance Andersen - Oracle wrote:
> From a portability point of view, yes that would be true. Parameter markers are not new and have been around for ages in the SQL Standard. Its unfortunate that Postgres chose not to follow the sql standard for parameter markers if I understand you correctly
Looking at
http://www.postgresql.org/docs/current/static/sql-prepare.html
PostgreSQL uses $1, $2 etc for the placeholders.
> Postgres could always add their own special syntax such as {postgres blah} or only support it via a class/method available within their own implementation. Many have done this type of thing for years.
Thanks, I've added it to my answer on stackoverflow.
> Adding an special escape syntax for an operator or specially for vendors has never come up before and I would need to see more support from other JDBC driver vendors. This would not happen for JDBC 4.2 but can be considered for a future JDBC release if there is enough support from the other vendors.
Might be an idea to add something to 13.4 in the general introduction,
or maybe just a footnote to the last sentence of 13.4.1* that vendors
can namespace an escape as in your example above if they really need to
escape something that is not defined in JDBC:
{<vendor-namespace> <whatever-needs-to-be-escaped>}
Where vendor-namespace would simply be something like your example, eg
postgres, oracle, etc.
*: The sentence that says (in JDBC 4.1): "The escape syntax is not
intended to be used to invoke user-defined or vendor specific scalar
functions."
--
Mark Rotteveel
More information about the jdbc-spec-discuss
mailing list