State of the support for the hstore ? operator

Поиск
Список
Период
Сортировка
От Thomas Kellerer
Тема State of the support for the hstore ? operator
Дата
Msg-id n2ha84$5u8$1@ger.gmane.org
обсуждение исходный текст
Ответы Re: State of the support for the hstore ? operator
Список pgsql-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

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Sehrope Sarkuni
Дата:
Сообщение: Re: Release for 9.5
Следующее
От: Albe Laurenz
Дата:
Сообщение: Re: State of the support for the hstore ? operator