From: | Andy Colson <andy(at)squeakycode(dot)net> |
---|---|
To: | David Johnston <polobo(at)yahoo(dot)com> |
Cc: | 'PostgreSQL' <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: string = any() |
Date: | 2012-01-10 16:33:27 |
Message-ID: | 4F0C6857.8050702@squeakycode.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 1/10/2012 10:28 AM, David Johnston wrote:
> -----Original Message-----
> From: pgsql-general-owner(at)postgresql(dot)org
> [mailto:pgsql-general-owner(at)postgresql(dot)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, even in psql:
>> select 'bob' = any( '{''joe'', ''bob'' }'::varchar[] )
>>
>> $$ ^ This works for me just fine....though 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 do
> to, otherwise something weird is going on.
>
> -----------------------------------------
>
> I execute the following:
>
> SELECT 'bob' = ANY( '{ "joe", "bob" }'::varchar[] );
>
> And it returns TRUE...
>
> This returns FALSE:
>
> SELECT 'bob' = ANY( '{ "joe", "dave" }'::varchar[] );
Yeah, that uses the correct double quotes... which I was not using.
>
> So:
>
> prepare x as select 'bob' = any(string_to_array($1, ',')::varchar[]);
> execute x ('joe,bob,billy');
>
> David J.
>
Ah, that's a good idea, I hadn't thought of that. Always another way to
skin a cat.
Thanks again,
-Andy
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2012-01-10 16:42:09 | Re: string = any() |
Previous Message | Ernesto Quiñones | 2012-01-10 16:30:36 | Re: Two indexes on same column |