From: Adam Rauch <adam@labkey.com>
To: Christopher BROWN <brown@reflexe.fr>
To: Dave Cramer <pg@fastcrypt.com>
Cc: Vladimir Sitnikov <sitnikov.vladimir@gmail.com>
Cc: Craig Ringer <craig@2ndquadrant.com>
Cc: Dang Minh Huong <kakalot49@gmail.com>
Cc: pgsql-jdbc@postgresql.org <pgsql-jdbc@postgresql.org>
Subject: Re: JDBC-94: "Multiple resultsets were returned by query" in query end with "; "
Date: Wed, 7 Oct 2015 11:42:20 -0700
Message-ID: <5615678C.4000005@labkey.com> (raw)
In-Reply-To: <CAHL_zcOUvRFBAttQSnRiOPqk8RFocq-dCMO3FOyrJ1OUZyQh-Q@mail.gmail.com>
References: <21DDBBC0-6A6E-4B9B-9A25-C0044EAF5250@gmail.com>
<CAMsr+YE3riG0vrVbxCFKYnG+UGSLPDnhA==BFG6ZcQxvqoNR5Q@mail.gmail.com>
<CADK3HHJ7a0LGY9XzEA6_8ejf5jp_QfUDK4d_kLv697Q--XH_hA@mail.gmail.com>
<CAB=Je-E6z4Ov2gsgBuy80CCLgKrDVfUk0Ab1p-gsPdYRJKWtmA@mail.gmail.com>
<CADK3HHL10T1F1v3wyqeVWMes5i=PNuyF_4bMX20Z5c8DgTyORg@mail.gmail.com>
<CAHL_zcOUvRFBAttQSnRiOPqk8RFocq-dCMO3FOyrJ1OUZyQh-Q@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>
I agree with Christopher. After upgrading to the latest JDBC driver our
system started throwing these exceptions. It's not hard for us to fix (I
can update our own framework code), but it seems unnecessary and is
likely more difficult for others to address.
Here's a simplified example of SQL-generatation code that runs afoul of
this change: in our system, a logical insert at one layer may map to
multiple database inserts (e.g., to a primary database table plus one or
more property tables). The code generating the insert SQL terminates
each INSERT with ";\n", for convenience and human readability. As a
result, the final INSERT can end with a dangling "\n" that 1202 now
rejects. Of course, we could duplicate a subsequent check and/or special
case the last INSERT to remove the "\n", but the current code is cleaner.
Adam
On 10/7/2015 5:42 AM, Christopher BROWN wrote:
> Hello,
>
> Developers that use the driver via a framework (open-source, in-house)
> might not be in a position to change SQL, compared with developers
> that are able to modify hand-written SQL, so it's probably best to
> tolerate it by discarding any trailing semi-colon (with or without any
> trailing whitespace) in the parser.
>
> I've also encountered coding practices (coding-style "standards")
> where semi-colons are expected (some people just love terminating all
> statements, not just Java, with semi-colons, even when it's not
> strictly necessary (e.g.: JavaScript).
>
> So, my preference would be to maintain backwards-compatibility for
> others, even if I don't have such an issue myself.
>
> --
> Christopher
>
>
> On 7 October 2015 at 14:34, Dave Cramer <pg@fastcrypt.com
> <mailto:pg@fastcrypt.com>> wrote:
>
> This is a very good question, but lots of people cut and paste SQL
> into code ... sometimes the ; gets in there.
>
> Behaviour of previous version is important, but in this case It
> may not be justified.
>
> Anyone else have an opinion ?
>
> Dave Cramer
>
> dave.cramer(at)credativ(dot)ca
> http://www.credativ.ca
>
> On 7 October 2015 at 08:30, Vladimir Sitnikov
> <sitnikov.vladimir@gmail.com <mailto:sitnikov.vladimir@gmail.com>>
> wrote:
>
> I wonder why pgjdbc would want to silently ignore that user error?
> Is "behavior of previous version" a sole justification?
>
> I've drafted https://github.com/pgjdbc/pgjdbc/pull/386 to
> cover that.
>
> Vladimir
>
>
>
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, brown@reflexe.fr, pg@fastcrypt.com, sitnikov.vladimir@gmail.com, craig@2ndquadrant.com, kakalot49@gmail.com
Subject: Re: JDBC-94: "Multiple resultsets were returned by query" in query end with "; "
In-Reply-To: <5615678C.4000005@labkey.com>
References: <21DDBBC0-6A6E-4B9B-9A25-C0044EAF5250@gmail.com> <CAMsr+YE3riG0vrVbxCFKYnG+UGSLPDnhA==BFG6ZcQxvqoNR5Q@mail.gmail.com> <CADK3HHJ7a0LGY9XzEA6_8ejf5jp_QfUDK4d_kLv697Q--XH_hA@mail.gmail.com> <CAB=Je-E6z4Ov2gsgBuy80CCLgKrDVfUk0Ab1p-gsPdYRJKWtmA@mail.gmail.com> <CADK3HHL10T1F1v3wyqeVWMes5i=PNuyF_4bMX20Z5c8DgTyORg@mail.gmail.com> <CAHL_zcOUvRFBAttQSnRiOPqk8RFocq-dCMO3FOyrJ1OUZyQh-Q@mail.gmail.com> <5615678C.4000005@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