Re: Simple queries with JDBC escaped scalar functions result in exceptions - Mailing list pgsql-jdbc

From Dave Cramer
Subject Re: Simple queries with JDBC escaped scalar functions result in exceptions
Date
Msg-id CADK3HHLFtYfqK0=Yw7OQAe60bViqz=JbBwOvsGiFhB6E5KFfeg@mail.gmail.com
Whole thread Raw
In response to Simple queries with JDBC escaped scalar functions result in exceptions  (Adam Rauch <adam@labkey.com>)
Responses Re: Simple queries with JDBC escaped scalar functions result in exceptions  (Andreas Joseph Krogh <andreas@visena.com>)
Re: Simple queries with JDBC escaped scalar functions result in exceptions  (danap <danap@itstriangle.com>)
Re: Simple queries with JDBC escaped scalar functions result in exceptions  (Andreas Joseph Krogh <andreas@visena.com>)
Re: Simple queries with JDBC escaped scalar functions resultin exceptions  (danap <danap@itstriangle.com>)
List pgsql-jdbc
Looks like the JDBC mini parser is having troubles with that. Why do you have comments in your sql ? 


On 27 August 2016 at 00:31, Adam Rauch <adam@labkey.com> wrote:
I upgraded to postgresql-9.4.1209.jar and fixed all the places in our code that used JDBC escaped scalar functions (e.g., {fn now()}) inside function definitions. However, we continued to see the telltale exception (org.postgresql.util.PSQLException: ERROR: syntax error at or near "{") when executing straightforward SELECT queries that included scalar functions. I tracked this down to comments; a simple repro is to execute the following query via JDBC:
SELECT /* $ */ {fn curdate()}
The original comments included many characters, but the dollar sign seems to be the culprit. I think this indicates a problem with the parser that's attempting to detect string literals.

Thanks,
Adam


pgsql-jdbc by date:

Previous
From: Dave Cramer
Date:
Subject: Re: Invoking a function within a batch statement
Next
From: Evan Meagher
Date:
Subject: Re: Invoking a function within a batch statement