Re: [GENERAL] string = any()

2012-01-11 Thread Filip Rembiałkowski
W dniu 10 stycznia 2012 22:52 użytkownik David Johnston napisał: > If you are going to supply one parameter per "possible value" anyway skip the > whole "ANY" and "ARRAY" and just say " 'bob' IN ($1, $2 [,...]) "; true :-) prepare($sql); $stmt->execute($names); ?> PHP from several years cries

Re: [GENERAL] string = any()

2012-01-10 Thread David Johnston
-Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Filip Rembialkowski Sent: Tuesday, January 10, 2012 4:27 PM To: Andy Colson Cc: PostgreSQL Subject: Re: [GENERAL] string = any() no, I meant array constructor with

Re: [GENERAL] string = any()

2012-01-10 Thread Filip Rembiałkowski
W dniu 10 stycznia 2012 16:17 użytkownik Andy Colson napisał: >> 2012/1/10 Andy Colson: >>> I am writing PHP where it prepares a statement like: >>> $sql = 'select * from aTable where id = any($1)'; >>> >>> then in php I create a string: >>> $args = "{1,2,3}"; >>> >>> And run it: >>> >>> $q = pg_q

Re: [GENERAL] string = any()

2012-01-10 Thread John R Pierce
On 01/10/12 8:18 AM, Andy Colson wrote: clayia=# select '{''joe'', ''bob'' }'; ?column? - {'joe', 'bob' } (1 row) It does return an array of string, or so it looks. I'm pretty sure that's just a string, not an array. -- john r pierceN 37, W 1

Re: [GENERAL] string = any()

2012-01-10 Thread Tom Lane
Andy Colson writes: > My confusion was from: > clayia=# select '{''joe'', ''bob'' }'; > ?column? > - > {'joe', 'bob' } > (1 row) > It does return an array of string, or so it looks. Yeah, it's not obvious that those quote marks are really data characters. I wonder whethe

Re: [GENERAL] string = any()

2012-01-10 Thread Andy Colson
On 1/10/2012 10:28 AM, David Johnston wrote: -Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Andy Colson Sent: Tuesday, January 10, 2012 11:20 AM To: David Johnston Cc: 'PostgreSQL' Subject: Re: [GENERAL] st

Re: [GENERAL] string = any()

2012-01-10 Thread David Johnston
-Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Andy Colson Sent: Tuesday, January 10, 2012 11:20 AM To: David Johnston Cc: 'PostgreSQL' Subject: Re: [GENERAL] string = any() > This still does not work,

Re: [GENERAL] string = any()

2012-01-10 Thread Andy Colson
This still does not work, even in psql: select 'bob' = any( '{''joe'', ''bob'' }'::varchar[] ) $$ ^ This works for me just finethough I am not using psql; are you having quoting issues? What error do you get? It runs, but it returns false. I get false at least. I'm assuming you

Re: [GENERAL] string = any()

2012-01-10 Thread Andy Colson
On 1/10/2012 10:11 AM, Tom Lane wrote: Andy Colson writes: This still does not work, even in psql: select 'bob' = any( '{''joe'', ''bob'' }'::varchar[] ) You've got the array quoting rules wrong here (should be double quote marks, not single quotes). You didn't show us your PHP code but I su

Re: [GENERAL] string = any()

2012-01-10 Thread Tom Lane
Andy Colson writes: > This still does not work, even in psql: > select 'bob' = any( '{''joe'', ''bob'' }'::varchar[] ) You've got the array quoting rules wrong here (should be double quote marks, not single quotes). You didn't show us your PHP code but I surmise that's got the same mistake. Rea

Re: [GENERAL] string = any()

2012-01-10 Thread David Johnston
$$ My comments embedded below -Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Andy Colson Sent: Tuesday, January 10, 2012 10:33 AM To: David Johnston Cc: 'PostgreSQL' Subject: Re: [GENERAL] string = any() On 1

Re: [GENERAL] string = any()

2012-01-10 Thread Andy Colson
On 1/10/2012 9:17 AM, David Johnston wrote: -Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Andy Colson Sent: Tuesday, January 10, 2012 10:04 AM To: PostgreSQL Subject: [GENERAL] string = any() Hi all. I am writing PHP

Re: [GENERAL] string = any()

2012-01-10 Thread David Johnston
-Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Andy Colson Sent: Tuesday, January 10, 2012 10:04 AM To: PostgreSQL Subject: [GENERAL] string = any() Hi all. I am writing PHP where it prepares a statement like: $sql = 's

Re: [GENERAL] string = any()

2012-01-10 Thread Andy Colson
2012/1/10 Andy Colson: Hi all. I am writing PHP where it prepares a statement like: $sql = 'select * from aTable where id = any($1)'; then in php I create a string: $args = "{1,2,3}"; And run it: $q = pg_query_params($db, $sql, $args); This is not actual code, just a sample. And it works g

Re: [GENERAL] string = any()

2012-01-10 Thread Filip Rembiałkowski
maybe try to use ARRAY constructor instead? http://www.postgresql.org/docs/9.0/static/sql-expressions.html#SQL-SYNTAX-ARRAY-CONSTRUCTORS 2012/1/10 Andy Colson : > Hi all. > > I am writing PHP where it prepares a statement like: > $sql = 'select * from aTable where id = any($1)'; > > then in php