From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-jdbc@postgresql.org
Subject: Re: JDBC and the hstore ? operator - no longer working with build 1211
Date: Thu, 2 Mar 2017 09:54:22 +0100
Message-ID: <o98mjn$dre$1@blaine.gmane.org> (raw)
In-Reply-To: <CAB=Je-HqKThJtpYJZ9tspv2amRV5Koa-Tb+B16NwNBeCywPrsg@mail.gmail.com>
References: <nv8bpg$ivu$1@blaine.gmane.org>
<CADK3HHJ50aqPHqGOdpeja1tHnpgju8HwKA9Yi8j_1wk0n58ifg@mail.gmail.com>
<CAB=Je-HqKThJtpYJZ9tspv2amRV5Koa-Tb+B16NwNBeCywPrsg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>
Vladimir Sitnikov schrieb am 01.11.2016 um 15:00:
>>This has been "broken" for a while now, you have to use ?? to get it to work.
This still doesn't work completely with a PreparedStatement.
Other hstore operators that start with an ? do not work: ?& and ?|
e.g.:
connection.prepareStatement("select * from foo where hstore_column ?& array['key']");
connection.prepareStatement("select * from foo where hstore_column ?| array['key']");
The prepareStatement() call succeeds, but when calling executeQuery() an exception is thrown:
org.postgresql.util.PSQLException: No value specified for parameter 1.
The goal is to pass the array as a parameter, something like:
Array keys = con.createArrayOf("text", new String[] {"key1","key2"});
connection.prepareStatement("select * from foo where hstore_column ?& ?");
pstmt.setArray(1, keys);
ResultSet rs = pstmt.executeQuery();
Tested with 1212 and 42.0.0
Regards
Thomas
--
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc
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: spam_eater@gmx.net
Subject: Re: JDBC and the hstore ? operator - no longer working with build 1211
In-Reply-To: <o98mjn$dre$1@blaine.gmane.org>
References: <nv8bpg$ivu$1@blaine.gmane.org> <CADK3HHJ50aqPHqGOdpeja1tHnpgju8HwKA9Yi8j_1wk0n58ifg@mail.gmail.com> <CAB=Je-HqKThJtpYJZ9tspv2amRV5Koa-Tb+B16NwNBeCywPrsg@mail.gmail.com> <o98mjn$dre$1@blaine.gmane.org>
* 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