Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cknC1-0004KU-Q8 for pgsql-jdbc@arkaria.postgresql.org; Mon, 06 Mar 2017 07:36:29 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cknC0-0006xx-TA for pgsql-jdbc@arkaria.postgresql.org; Mon, 06 Mar 2017 07:36:28 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cknC0-0006xV-EX for pgsql-jdbc@postgresql.org; Mon, 06 Mar 2017 07:36:28 +0000 Received: from [195.159.176.226] (helo=blaine.gmane.org) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1cknBu-0004jd-Gw for pgsql-jdbc@postgresql.org; Mon, 06 Mar 2017 07:36:27 +0000 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1cknBm-00051v-Rf for pgsql-jdbc@postgresql.org; Mon, 06 Mar 2017 08:36:14 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-jdbc@postgresql.org From: Thomas Kellerer Subject: Re: JDBC and the hstore ? operator - no longer working with build 1211 Date: Mon, 6 Mar 2017 08:36:13 +0100 Lines: 27 Message-ID: References: <7cab903f4c0f8cd90f83f71db275f6ce@lawinegevaar.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@blaine.gmane.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 In-Reply-To: <7cab903f4c0f8cd90f83f71db275f6ce@lawinegevaar.nl> X-Host-Lookup-Failed: Reverse DNS lookup failed for 195.159.176.226 (failed) X-Pg-Spam-Score: -0.9 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org 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 -- Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-jdbc