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

From: Adam Rauch <adam(at)labkey(dot)com>
To: Vladimir Sitnikov <sitnikov(dot)vladimir(at)gmail(dot)com>, Andreas Joseph Krogh <andreas(at)visena(dot)com>
Cc: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>, Dave Cramer <pg(at)fastcrypt(dot)com>
Subject: Re: Simple queries with JDBC escaped scalar functions result in exceptions
Date: 2016-08-28 17:02:55
Message-ID: b8dc2e7f-b788-7fde-bdec-be1d6dcb686c@labkey.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-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

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message danap 2016-08-28 17:17:15 Re: Simple queries with JDBC escaped scalar functions result in exceptions
Previous Message Vladimir Sitnikov 2016-08-28 15:00:02 Re: Simple queries with JDBC escaped scalar functions result in exceptions