Simple queries with JDBC escaped scalar functions result in exceptions

From: Adam Rauch <adam(at)labkey(dot)com>
To: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Simple queries with JDBC escaped scalar functions result in exceptions
Date: 2016-08-27 04:31:40
Message-ID: 02c61eb2-e2da-4e9c-281b-18bf60ea48b1@labkey.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Evan Meagher 2016-08-27 19:06:13 Re: Invoking a function within a batch statement
Previous Message Victor Wagner 2016-08-26 04:47:30 Re: Patch: Implement failover on libpq connect level.