Re: Problems with question marks in operators (JDBC, ECPG, ...)

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Kevin Grittner <kgrittn(at)ymail(dot)com>
Cc: Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>, Jan de Visser <jan(at)de-visser(dot)net>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Problems with question marks in operators (JDBC, ECPG, ...)
Date: 2015-05-19 20:50:00
Message-ID: CAKFQuwa_17RciDta6FFsqB+Uo=Yb7ZaQhxzaSnE39fpwZTuzsg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, May 19, 2015 at 1:36 PM, Kevin Grittner <kgrittn(at)ymail(dot)com> wrote:

> Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz> wrote:
>
> > I prefer the $1 approach, others can't use that, and there are
> > situations where I could not either.
> >
> > So, how about defaulting to the '?' approach, but have a method
> > to explicitly set the mode - to switch to using '$'?
>
> Are you suggesting that we implement something other than what is
> described in these documents for prepared statement parameters?:
>
> http://docs.oracle.com/javase/7/docs/api/java/sql/PreparedStatement.html
>
>
> http://download.oracle.com/otn-pub/jcp/jdbc-4_1-mrel-spec/jdbc4.1-fr-spec.pdf
>
> If so, I strongly oppose that. If we are not going to deprecate
> use of the question mark character for operators, we need some
> nonstandard hack to our JDBC implementation, but an alternative
> syntax for specifying PreparedStatement and CallableStatement
> parameters seems entirely the wrong way to go.
>

​I'll repeat my earlier comment that having a mode that allows for libpq
syntax while still conforming to the JDBC class API would have value for
those users willing to admit their application and code is not portable
(and if they are using these operators it is not) and would rather conform
as closely to native PostgreSQL language mechanics as possible.​

​That said I would not argue that the current official driver needs to be
so modified.​

> The issue here is what to do about the difficulties in using JDBC
> prepared statements in combination with the PostgreSQL extension of
> operator names containing question marks. Using a double question
> mark is not horrible as a solution. It may not be what we would
> have arrived at had the discussion taken place on the pgsql-jdbc
> list rather than underneath a github pull request, but we can
> only move forward from where we are.
>
> Out of curiosity, how long has the ?? solution been implemented in
> a driver jar file available as a public download?

​Less than 6 months...discussion started a few months prior to that.

> What are the
> guidelines for what discussion belongs on the pgsql-jdbc list and
> what discussion belongs on github? Is someone interested in
> participating in the discussions leading to decisions about our
> JDBC connector expected to follow both?
>
>
As things stand now - it seems that way. There are no guidelines that I
can tell but I'd likely consider pgsql-jdbc the equivalent of -general and
GitHub looks like -hackers. Neither is particularly high volume.

​David J.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dave Cramer 2015-05-19 20:51:43 Re: Problems with question marks in operators (JDBC, ECPG, ...)
Previous Message Peter Geoghegan 2015-05-19 20:49:50 Re: INSERT ... ON CONFLICT DO UPDATE with _any_ constraint