Re: problem with array query
| От | Tom Lane |
|---|---|
| Тема | Re: problem with array query |
| Дата | |
| Msg-id | 12232.1254102178@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | problem with array query (Grant Maxwell <grant.maxwell@maxan.com.au>) |
| Ответы |
Re: problem with array query
|
| Список | pgsql-general |
Grant Maxwell <grant.maxwell@maxan.com.au> 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
В списке pgsql-general по дате отправления: