pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-jdbc@postgresql.org
Subject: State of the support for the hstore ? operator
Date: Wed, 18 Nov 2015 08:44:04 +0100
Message-ID: <n2ha84$5u8$1@ger.gmane.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>

Hello,

I just stumbled upon this (using postgresql-9.4-1205.jdbc42.jar)

  Statement stmt = con.createStatement();
  ResultSet rs = stmt.executeQuery("select count(*) from product where attributes ? 'location_id'");

results in 

   org.postgresql.util.PSQLException: ERROR: syntax error at or near "$1"

"product.attributes" is a hstore column:
  
I recall a discussion about this problem a while ago, but I can't find it any more. 

While I certainly would expect a problem when using a PreparedStatement I am surprised 
that a "plain" executeQuerys() also tries to do parameter replacement.

I have found the suggestion to use exist(attributes, 'location_id') but that is not 
an option as that does not use the index on the column.

So what is the state of this? Do we have a way of escaping the ? operator? 

I couldn't find anything in the documentation.

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



view thread (5+ messages)  latest in thread

Message-ID: <n2ha84$5u8$1@ger.gmane.org>
Permalink:  ../n2ha84$5u8$1@ger.gmane.org/
Also on:    postgresql.org/message-id/n2ha84$5u8$1@ger.gmane.org

 · 

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: spam_eater@gmx.net
  Subject: Re: State of the support for the hstore ? operator
  In-Reply-To: <n2ha84$5u8$1@ger.gmane.org>
  References: <n2ha84$5u8$1@ger.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