Re: [JDBC] Re: JDBC and the hstore ? operator - no longer workingwith build 1211 - Mailing list pgsql-jdbc

From Mark Rotteveel
Subject Re: [JDBC] Re: JDBC and the hstore ? operator - no longer workingwith build 1211
Date
Msg-id 7cab903f4c0f8cd90f83f71db275f6ce@lawinegevaar.nl
Whole thread Raw
In response to [JDBC] Re: JDBC and the hstore ? operator - no longer working with build1211  (Thomas Kellerer <spam_eater@gmx.net>)
Responses Re: [JDBC] Re: JDBC and the hstore ? operator - no longer workingwith build 1211  (Vladimir Sitnikov <sitnikov.vladimir@gmail.com>)
[JDBC] Re: JDBC and the hstore ? operator - no longer working with build1211  (Thomas Kellerer <spam_eater@gmx.net>)
Re: Re: JDBC and the hstore ? operator - no longer workingwith build 1211  (Vladimir Sitnikov <sitnikov.vladimir@gmail.com>)
Re: JDBC and the hstore ? operator - no longer working with build1211  (Thomas Kellerer <spam_eater@gmx.net>)
List pgsql-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


pgsql-jdbc by date:

Previous
From: Thomas Kellerer
Date:
Subject: Re: JDBC and the hstore ? operator - no longer working with build1211
Next
From: Vladimir Sitnikov
Date:
Subject: Re: Re: JDBC and the hstore ? operator - no longer workingwith build 1211