Re: Problems with question marks in operators (JDBC, ECPG, ...) - Mailing list pgsql-hackers

From David G. Johnston
Subject Re: Problems with question marks in operators (JDBC, ECPG, ...)
Date
Msg-id CAKFQuwY=N5kmpoDUEiT+igqBKjZGTmdegAywJeXe=dyyW4ZR_A@mail.gmail.com
Whole thread Raw
In response to Re: Problems with question marks in operators (JDBC, ECPG, ...)  (Dave Cramer <pg@fastcrypt.com>)
List pgsql-hackers
On Fri, May 15, 2015 at 1:45 PM, Dave Cramer <pg@fastcrypt.com> wrote:
On 15 May 2015 at 16:44, Dave Cramer <pg@fastcrypt.com> wrote:


On 15 May 2015 at 16:41, Robert Haas <robertmhaas@gmail.com> wrote:
On Fri, May 15, 2015 at 4:38 PM, Dave Cramer <pg@fastcrypt.com> wrote:
>> I don't really want to take a violently strong position on this
>> without understanding what's really going on here.
>>
> Well our solution was to use ?? but that does mean we have to do some extra
> parsing which in a perfect world wouldn't be necessary.

So what about strings quoted with '' or $$ or $something$ - how would
you handle those?

We parse for strings; the ?? just adds to the parsing load which we really try to avoid.


The ?? is just harder to deal with because ? is part of the JDBC spec as a placeholder 


​Whenever I ponder this I always come back to the idea of having a driver (or driver mode) that integrates with the Java API that JDBC specifies but whose parsing implementation adheres to libpq.  This would, intentionally, be a driver that could not be used with "portable" source code but would allow people who are OK with binding tightly with PostgreSQL to talk in its native language.

As for alternative operators maybe pgJDBC should put one or more extensions out on PGXN that would be considered an official compatibility ​mode that developers can write against and setup as dependency.  Avoids each application developing its own mapping rules and the resultant problems that could result in doing so.  At worse it at least makes the issue more visible if done fully.

I'm not particularly in favor of deprecating the existing operators though I haven't given it that much thought either.  Since using them results in syntax errors the harm in allowing them seems fairly minimal.  The use of "?" as an operator is normally done for solid reasons and clarity is not something to be discarded for everyone when only a subset are affected.

David J.

pgsql-hackers by date:

Previous
From: Bruno Harbulot
Date:
Subject: Re: Problems with question marks in operators (JDBC, ECPG, ...)
Next
From: Alvaro Herrera
Date:
Subject: Re: BRIN range operator class