Search Postgresql Archives

Re: problem with array query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Grant Maxwell <grant.maxwell@xxxxxxxxxxxx> writes:
> 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
>    owners character varying(1024)[],

No, what you can write is "<> ALL", not NOT IN.

> It seems as though postgres is not recognising owners as an array.

It's trying to parse the literal as an array so that it can do a
plain equality comparison against the owners column.

You probably read the part of the docs where it says that
x NOT IN (SELECT ...) is equivalent to x <> ALL (SELECT ...).
Which is true, but it has nothing to do with the non-sub-SELECT syntax.
Without a sub-SELECT, we have two cases:
x NOT IN (y,z,...) expects x,y,z to all be the same type.
x <> ALL (y) expects y to be an array of x's type.
Got it?

			regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux