pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dawid Kuroczko <qnex42@gmail.com>
To: pgsql-sql <pgsql-sql@postgresql.org>
Subject: Subselects returning array and ANY...
Date: Thu, 28 Feb 2008 01:01:57 +0100
Message-ID: <758d5e7f0802271601m592a932bh5916b10eccecbb4a@mail.gmail.com> (raw)

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



view thread (4+ messages)  latest in thread

Message-ID: <758d5e7f0802271601m592a932bh5916b10eccecbb4a@mail.gmail.com>
Permalink:  ../758d5e7f0802271601m592a932bh5916b10eccecbb4a@mail.gmail.com/
Also on:    postgresql.org/message-id/758d5e7f0802271601m592a932bh5916b10eccecbb4a@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: qnex42@gmail.com
  Subject: Re: Subselects returning array and ANY...
  In-Reply-To: <758d5e7f0802271601m592a932bh5916b10eccecbb4a@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox