Re: Why does this array query fail? - Mailing list pgsql-general

From bricklen
Subject Re: Why does this array query fail?
Date
Msg-id CAGrpgQ8xykA40nkovjDpvp1G9Q6HkTbc3KGc1quLmujWdcXV1Q@mail.gmail.com
Whole thread Raw
In response to Re: Why does this array query fail?  (Ken Tanzer <ken.tanzer@gmail.com>)
Responses Re: Why does this array query fail?  (Ken Tanzer <ken.tanzer@gmail.com>)
List pgsql-general

On Mon, Sep 16, 2013 at 6:36 PM, Ken Tanzer <ken.tanzer@gmail.com> wrote:
Thanks for the explanation.  I think I at least understand what it's doing now.  I'm either surprised or confused though, as I was under the impression that you could substitute a subquery for a value pretty much anywhere, but I guess that's not the case?

Cheers,
Ken


Your subquery can also be explicitly casted to make it work. Note the "::TEXT[]"

SELECT 'found' WHERE 'test' = ANY( (SELECT ARRAY['test','pass','fail'])::TEXT[] );

pgsql-general by date:

Previous
From: Ken Tanzer
Date:
Subject: Re: Why does this array query fail?
Next
From: Ken Tanzer
Date:
Subject: Re: Why does this array query fail?