Subselects returning array and ANY... - Mailing list pgsql-sql

From Dawid Kuroczko
Subject Subselects returning array and ANY...
Date
Msg-id 758d5e7f0802271601m592a932bh5916b10eccecbb4a@mail.gmail.com
Whole thread Raw
Responses Re: Subselects returning array and ANY...
List 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 by date:

Previous
From: "miquel_ibanez"
Date:
Subject: operator class
Next
From: Josh Berkus
Date:
Subject: Re: Subselects returning array and ANY...