Re: Simple queries with JDBC escaped scalar functions result in exceptions

From: Dave Cramer <pg(at)fastcrypt(dot)com>
To: Adam Rauch <adam(at)labkey(dot)com>
Cc: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Simple queries with JDBC escaped scalar functions result in exceptions
Date: 2016-08-28 01:18:42
Message-ID: CADK3HHLFtYfqK0=Yw7OQAe60bViqz=JbBwOvsGiFhB6E5KFfeg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Looks like the JDBC mini parser is having troubles with that. Why do you
have comments in your sql ?

Dave Cramer

davec(at)postgresintl(dot)com
www.postgresintl.com

On 27 August 2016 at 00:31, Adam Rauch <adam(at)labkey(dot)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
>
>

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Andreas Joseph Krogh 2016-08-28 13:43:04 Re: Simple queries with JDBC escaped scalar functions result in exceptions
Previous Message Evan Meagher 2016-08-27 22:35:58 Re: Invoking a function within a batch statement