Why does this array query fail?

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

Hi. Can someone explain to me why the last query below is failing, or what
exactly the error message means? I'm sure there's a simple reason, but I'm
totally not seeing it. I boiled this down from a more complicated example,
but I think the problem is the same. Thanks in advance.

Ken

ets_reach=> SELECT ARRAY['test','pass','fail'];
array
------------------
{test,pass,fail}
(1 row)

ets_reach=> SELECT 'found' WHERE 'test' = ANY( ARRAY['test','pass','fail']
);
?column?
----------
found
(1 row)

ets_reach=> SELECT 'found' WHERE ARRAY['test','pass','fail'] = (SELECT
ARRAY['test','pass','fail']);
?column?
----------
found
(1 row)

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...
^

--
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.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message bricklen 2013-09-17 01:07:06 Re: Why does this array query fail?
Previous Message karinos57 2013-09-16 23:55:52 using Replace funcion in postgresql