Mark Rotteveel schrieb am 02.03.2017 um 19:10:
>> 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 ??
That indeed does work.
We first tried it with an obfuscation layer (aka "ORM") which seems to mess around with those operators and breaks that
escaping.
Thomas