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

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

               http://archives.postgresql.org

Reply via email to