pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mark Rotteveel <mark@lawinegevaar.nl>
To: pgsql-jdbc@postgresql.org
Subject: Re: Re: JDBC and the hstore ? operator - no longer working with build 1211
Date: Thu, 02 Mar 2017 19:10:16 +0100
Message-ID: <7cab903f4c0f8cd90f83f71db275f6ce@lawinegevaar.nl> (raw)
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>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>

On 2017-03-02 09:54, Thomas Kellerer wrote:
> 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

I haven't tried it, but would you logically need to use ??& and ??|, if 
the ? operator is escaped using ??

Mark


-- 
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc



view thread (16+ messages)  latest in thread

Message-ID: <7cab903f4c0f8cd90f83f71db275f6ce@lawinegevaar.nl>
Permalink:  ../7cab903f4c0f8cd90f83f71db275f6ce@lawinegevaar.nl/
Also on:    postgresql.org/message-id/7cab903f4c0f8cd90f83f71db275f6ce@lawinegevaar.nl

 · 

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: mark@lawinegevaar.nl
  Subject: Re: JDBC and the hstore ? operator - no longer working with build 1211
  In-Reply-To: <7cab903f4c0f8cd90f83f71db275f6ce@lawinegevaar.nl>
  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> <7cab903f4c0f8cd90f83f71db275f6ce@lawinegevaar.nl>

* 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