what am I doing wrong with this query?

From: Tony Caduto <tony_caduto(at)amsoftwaredesign(dot)com>
To: Postgres general mailing list <pgsql-general(at)postgresql(dot)org>
Subject: what am I doing wrong with this query?
Date: 2006-01-20 17:12:33
Message-ID: 43D11A01.5020605@amsoftwaredesign.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

select array_to_string(conkey,',') from pg_constraint where contype =
'p' and conrelid = 17059

returns a value of 1,2,18 for the array to string function,

when I do this it does not return true:

select case when 18 in (array_to_string(conkey,',')) then true else
false end from pg_constraint where contype = 'p' and conrelid = 17059

but this one does return true

select case when 18 in (1,2,18) then true else false end from
pg_constraint where contype = 'p' and conrelid = 17059

How come the function does not work in the IN statement? I tried
casting it to a varchar, but that did not work either.

Thanks,

Tony

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2006-01-20 17:14:35 Re: Creation of tsearch2 index is very slow
Previous Message Tom Lane 2006-01-20 17:09:13 Re: Creation of tsearch2 index is very slow