Обсуждение: "?" hstore operator broken in 9.2?
Hi,
When I execute the following query:
SELECT 'a=>1'::hstore ? 'a'::text
I get an “Input parameter count is less then expected” error message.
SELECT defined('a=>1'::hstore, 'a'::text) -- works
I have tried on Linux Ubuntu (9.2.1) and Windows 7 (9.2.2) machines.
My knowledge and experience with the system catalogs is limited so if you need additional information please be specific.
Thanks!
Dave
On 12/24/2012 4:45 PM, David Johnston wrote:
SELECT 'a=>1'::hstore ? 'a'::text
fwiw, this works for me...
select hstore 'a=>1' ? 'a';
'something'::SOMETYPE is a type cast operation, while SOMETYPE 'something' is a constant of SOMETYPE. I didn't bother to cast 'a' to text as 'a' *is* text by default.
"David Johnston" <polobo@yahoo.com> writes: > When I execute the following query: > SELECT 'a=>1'::hstore ? 'a'::text FWIW, works fine for me. > I get an "Input parameter count is less then expected" error message. I can't find such a message (or indeed anything mentioning "parameter count") anywhere in the Postgres sources. Are you running this query bare in psql, or using some other client-side software? Could the message be coming from the client-side code? regards, tom lane
On 12/24/2012 6:33 PM, Tom Lane wrote: > "David Johnston"<polobo@yahoo.com> writes: >> >When I execute the following query: >> >SELECT 'a=>1'::hstore ? 'a'::text > FWIW, works fine for me. > >> >I get an "Input parameter count is less then expected" error message. > I can't find such a message (or indeed anything mentioning "parameter > count") anywhere in the Postgres sources. Are you running this query > bare in psql, or using some other client-side software? Could the > message be coming from the client-side code? AHHH! in particular a language binding that uses ? as a placeholder for parameterized query arguments... just guessing....
> -----Original Message----- > From: pgsql-general-owner@postgresql.org [mailto:pgsql-general- > owner@postgresql.org] On Behalf Of Tom Lane > Sent: Monday, December 24, 2012 9:34 PM > To: David Johnston > Cc: pgsql-general@postgresql.org > Subject: Re: [GENERAL] "?" hstore operator broken in 9.2? > > "David Johnston" <polobo@yahoo.com> writes: > > When I execute the following query: > > SELECT 'a=>1'::hstore ? 'a'::text > > FWIW, works fine for me. > > > I get an "Input parameter count is less then expected" error message. > > I can't find such a message (or indeed anything mentioning "parameter > count") anywhere in the Postgres sources. Are you running this query bare > in psql, or using some other client-side software? Could the message be > coming from the client-side code? > > regards, tom lane > Sorry for the noise. Indeed I use a third-party GUI and it seems that it is wanting to handle the "?" as an input parameter placeholder as opposed to an operator. I just lit up psql and confirmed that test query executed as expected. I get a "syntax error at or near $1" when I try to send a similar query through the JDBC driver (as part of a create table column check constraint). Given that direct function calls are available for all of the question-mark containing operators I'll likely just stick to those for now. I'm unsure whether this a fundamental issue with JDBC and related escaping (or the equivalent for the commercial GUI that I use) or if a solution is possible (I would assume yes given psql seems to know how to deal with it) but having now realized the situation I'll be able to course-correct in the future. Thanks for the quick response! Dave