From: | Ken Tanzer <ken(dot)tanzer(at)gmail(dot)com> |
---|---|
To: | David Johnston <polobo(at)yahoo(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:36:40 |
Message-ID: | CAD3a31VxPWmeavjUo-VAGHNa5xVA73m_V_idSX3DETR7L4wDMg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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
On Mon, Sep 16, 2013 at 6:16 PM, David Johnston <polobo(at)yahoo(dot)com> wrote:
> Ken Tanzer wrote
> > ets_reach=> SELECT 'found' WHERE 'test' = ANY( (SELECT
> > ARRAY['test','pass','fail']) );
> >
> > ERROR: array value must start with "{" or dimension information
> > LINE 1: SELECT 'found' WHERE 'test' = ANY( (SELECT ARRAY['test','pas...
> > ^
>
> Per documentation of "ANY" it accepts either an array or a subquery. This
> is the subquery form. PostgreSQL is trying to convert 'test' into an array
> in order to match the array column returned by the subquery.
>
> Remove the "SELECT" to make it work the way you expect - i.e., the
> ANY(array) form of the expression.
>
> David J.
>
>
>
>
>
> --
> View this message in context:
> http://postgresql.1045698.n5.nabble.com/Why-does-this-array-query-fail-tp5771165p5771170.html
> Sent from the PostgreSQL - general mailing list archive at Nabble.com.
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>
--
AGENCY Software
A data system that puts you in control
100% Free Software
*http://agency-software.org/*
ken(dot)tanzer(at)agency-software(dot)org
(253) 245-3801
Subscribe to the mailing
list<agency-general-request(at)lists(dot)sourceforge(dot)net?body=subscribe>
to
learn more about AGENCY or
follow the discussion.
From | Date | Subject | |
---|---|---|---|
Next Message | bricklen | 2013-09-17 01:42:19 | Re: Why does this array query fail? |
Previous Message | Adrian Klaver | 2013-09-17 01:22:50 | Re: using Replace funcion in postgresql |