pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adam Rauch <adam@labkey.com>
To: Vladimir Sitnikov <sitnikov.vladimir@gmail.com>
To: Andreas Joseph Krogh <andreas@visena.com>
Cc: pgsql-jdbc@postgresql.org <pgsql-jdbc@postgresql.org>
Cc: Dave Cramer <pg@fastcrypt.com>
Subject: Re: Simple queries with JDBC escaped scalar functions result in exceptions
Date: Sun, 28 Aug 2016 10:02:55 -0700
Message-ID: <b8dc2e7f-b788-7fde-bdec-be1d6dcb686c@labkey.com> (raw)
In-Reply-To: <CAB=Je-FeBZ0yis7OeJ7WH0cGLkDCUeZ4G0D37FxJLPij0v2KZg@mail.gmail.com>
References: <VisenaEmail.7.6d85467e04092837.156d161b73e@tc7-visena>
	<c575b722-df04-91a6-8d17-e88071ca11c0@labkey.com>
	<CAB=Je-FeBZ0yis7OeJ7WH0cGLkDCUeZ4G0D37FxJLPij0v2KZg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>

Thanks, Vladimir! Local build of 9.4.1210-SNAPSHOT works great; all my 
legal test queries execute successfully now.

Just FYI, the new driver threw java.lang.ArrayIndexOutOfBoundsException 
with an _illegal_ query: SELECT /* /* */ 1

    java.lang.ArrayIndexOutOfBoundsException
         at
    java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:597)
         at java.lang.StringBuilder.append(StringBuilder.java:190)
         at org.postgresql.core.Parser.parseSql(Parser.java:1037)
         at org.postgresql.core.Parser.replaceProcessing(Parser.java:974)
         at
    org.postgresql.core.CachedQueryCreateAction.create(CachedQueryCreateAction.java:43)
         at
    org.postgresql.core.CachedQueryCreateAction.create(CachedQueryCreateAction.java:19)
         at org.postgresql.util.LruCache.borrow(LruCache.java:118)
         at
    org.postgresql.core.QueryExecutorBase.borrowQuery(QueryExecutorBase.java:261)
         at
    org.postgresql.jdbc.PgConnection.borrowQuery(PgConnection.java:146)
         at
    org.postgresql.jdbc.PgPreparedStatement.<init>(PgPreparedStatement.java:91)
         at
    org.postgresql.jdbc.PgConnection.prepareStatement(PgConnection.java:1259)
         at
    org.postgresql.jdbc.PgConnection.prepareStatement(PgConnection.java:1625)
         at
    org.postgresql.jdbc.PgConnection.prepareStatement(PgConnection.java:418)

I'm not suggesting this needs to be addressed... unbalanced comments 
will of course be rejected by the server anyway.

Thanks,
Adam

On 8/28/2016 8:00 AM, Vladimir Sitnikov wrote:
> >The dollar sign ($) is the only case we came across in our test environments, but it looks 
> like a single quote (') or double quote (") in a comment also trips up 
> the parser. As do the two-character combinations {D, {E, {F, {O, and 
> {T... and their lowercase equivalents. A full set of test queries that 
> fail when executed via postgresql-9.4.1209.jar:
>
> Thanks for the analysis.
>
> I think 
> https://github.com/pgjdbc/pgjdbc/commit/2d9b313160dc5b73df2ae9001795592b37e8e8e0 should 
> fix the issue.
>
> The fix is available in 9.4.1210-SNAPSHOT
>
> Vladimir

view thread (7+ messages)  latest in thread

Message-ID: <b8dc2e7f-b788-7fde-bdec-be1d6dcb686c@labkey.com>
Permalink:  ../b8dc2e7f-b788-7fde-bdec-be1d6dcb686c@labkey.com/
Also on:    postgresql.org/message-id/b8dc2e7f-b788-7fde-bdec-be1d6dcb686c@labkey.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: adam@labkey.com, sitnikov.vladimir@gmail.com, andreas@visena.com, pg@fastcrypt.com
  Subject: Re: Simple queries with JDBC escaped scalar functions result in exceptions
  In-Reply-To: <b8dc2e7f-b788-7fde-bdec-be1d6dcb686c@labkey.com>
  References: <VisenaEmail.7.6d85467e04092837.156d161b73e@tc7-visena> <c575b722-df04-91a6-8d17-e88071ca11c0@labkey.com> <CAB=Je-FeBZ0yis7OeJ7WH0cGLkDCUeZ4G0D37FxJLPij0v2KZg@mail.gmail.com> <b8dc2e7f-b788-7fde-bdec-be1d6dcb686c@labkey.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox