Subselects returning array and ANY...

Поиск
Список
Период
Сортировка
От Dawid Kuroczko
Тема Subselects returning array and ANY...
Дата
Msg-id 758d5e7f0802271601m592a932bh5916b10eccecbb4a@mail.gmail.com
обсуждение исходный текст
Ответы Re: Subselects returning array and ANY...
Список pgsql-sql
A simple text case

=# CREATE TEMP TABLE foo (t text);
CREATE TABLE
=# INSERT INTO foo SELECT 'x'||n FROM generate_series(1,100) AS x(n);
INSERT 0 100

This works: SELECT * FROM foo WHERE t = ANY ('{x4,5,zzz}'::text[]);

And this works too: SELECT * FROM foo WHERE t IN (SELECT t FROM foo LIMIT 5);

...now, what am I doing wrong with this query?
  SELECT * FROM foo WHERE t = ANY (SELECT '{x4,5,zzz}'::text[]);
ERROR:  operator does not exist: text = text[]
HINT:  No operator matches the given name and argument type(s). You
might need to add explicit type casts.

I have a table containing text array field, and I want to use this
field in subselect...
I know it must be simple...  (without defining new operators).

Thanks in advance!

Dawid


В списке pgsql-sql по дате отправления:

Предыдущее
От: "miquel_ibanez"
Дата:
Сообщение: operator class
Следующее
От: Josh Berkus
Дата:
Сообщение: Re: Subselects returning array and ANY...