Re: Why does this array query fail?

From: bricklen <bricklen(at)gmail(dot)com>
To: Ken Tanzer <ken(dot)tanzer(at)gmail(dot)com>
Cc: PG-General Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: Re: Why does this array query fail?
Date: 2013-09-17 01:42:19
Message-ID: CAGrpgQ8xykA40nkovjDpvp1G9Q6HkTbc3KGc1quLmujWdcXV1Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Sep 16, 2013 at 6:36 PM, Ken Tanzer <ken(dot)tanzer(at)gmail(dot)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[] );

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ken Tanzer 2013-09-17 01:59:05 Re: Why does this array query fail?
Previous Message Ken Tanzer 2013-09-17 01:36:40 Re: Why does this array query fail?