From: | Vladimir Sitnikov <sitnikov(dot)vladimir(at)gmail(dot)com> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org, Mark Rotteveel <mark(at)lawinegevaar(dot)nl> |
Subject: | Re: Re: JDBC and the hstore ? operator - no longer working with build 1211 |
Date: | 2017-03-02 19:04:34 |
Message-ID: | CAB=Je-Efwwv9Dapkwd6KvSNtMxJbLgLELr=wxS2cgziBjaurCA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Mark>I haven't tried it, but would you logically need to use ??& and ??|, if
the ? operator is escaped using ??
That's right.
PreparedStatement requires ? to be represented as ?? (that is pgjdbc's
quirk).
Regular statement (non prepared) does not require ?? escaping.
pgjdbc does not parse statements hard enough to tell if the particular ? is
a bind variable or if it is a part of json operator.
Pull requests are welcome (provided parsing does not take too much CPU)
Vladimir
чт, 2 мар. 2017 г. в 21:10, Mark Rotteveel <mark(at)lawinegevaar(dot)nl>:
> 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(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-jdbc
>
From | Date | Subject | |
---|---|---|---|
Next Message | Tsunakawa, Takayuki | 2017-03-03 07:15:45 | Re: Statement-level rollback |
Previous Message | Mark Rotteveel | 2017-03-02 18:10:16 | Re: Re: JDBC and the hstore ? operator - no longer working with build 1211 |