Re: problem with array query

From: Ludwig Kniprath <ludwig(at)kni-online(dot)de>
To: Grant Maxwell <grant(dot)maxwell(at)maxan(dot)com(dot)au>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: problem with array query
Date: 2009-09-28 07:51:58
Message-ID: 4AC06B1E.5060001@kni-online.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I don't know about Postgres 8.3, but with 8.4-docs the Syntax of your
query could be

select * from tblretrain where NOT ('ms-ap-t2-02c9' = ANY (owners));

regards
Ludwig

Grant Maxwell schrieb:
> Hi Folks
>
> According to the 8.3 docs I should be able to write:
> select * from tblretrain where 'ms-ap-t2-02c9' NOT IN (owners);
>
> where owners is an array per the following definition
>
> CREATE TABLE tblretrain
> (
> pkretrainid integer NOT NULL,
> mailid integer NOT NULL,
> train_to smallint NOT NULL,
> owners character varying(1024)[],
> bayes_trained boolean DEFAULT false,
> contents text NOT NULL,
> CONSTRAINT tblretrain_pk PRIMARY KEY (pkretrainid)
> )
>
> The problem is that it generates an error:
>
> ERROR: array value must start with "{" or dimension information
> ********** Error **********
> ERROR: array value must start with "{" or dimension information
> SQL state: 22P02
>
> It seems as though postgres is not recognising owners as an array.
>
> Any suggestions please ?
> regards
> Grant
>
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Johan Nel 2009-09-28 08:00:17 Re: generic modelling of data models; enforcing constraints dynamically...
Previous Message Sergey Konoplev 2009-09-28 07:12:08 Re: Wrong rows count estimation (explain, gist, tsearch)