Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 0AAB42E004C for ; Wed, 27 Feb 2008 20:02:02 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 60201-03 for ; Wed, 27 Feb 2008 20:01:59 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from mu-out-0910.google.com (mu-out-0910.google.com [209.85.134.190]) by postgresql.org (Postfix) with ESMTP id 6257C2E0030 for ; Wed, 27 Feb 2008 20:01:59 -0400 (AST) Received: by mu-out-0910.google.com with SMTP id i10so5007648mue.5 for ; Wed, 27 Feb 2008 16:01:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; bh=bz8v+f/TJ1wtR3e+p7equiRTPhFHVFNqWRdXCCng4s4=; b=E1zg08osuRJ/k1hu4h0PiCa0yvqtukHbdsoLaCjor0PYSUnHh6qn5tT0qvgZEitqLY0DxDfqJ2XUhs+Su583AoSRjUzPtyn9PQpdLr7OweNG9RH37ZEwp7a/NY4XlPwS+zzJ5PfZkFx+Dx6BUJRLR0VkZcAUx6sEKko4ZSDw5uU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=IBHeNxk+RGo+OMdu5MBq9DWO3FIocca8C96R8vJKbltTZMKVDYuGR5ukzxvAZ2CoprJbJH1bzOqoeL5XVyqWylgM3U27Phx1uwZnkQ1xZJN7/oYe7mjdJogdHW3uFQEZhvN3NDislpOs8pBiWqwTZDmdxd2PJIbqXmktyGscxVU= Received: by 10.82.186.5 with SMTP id j5mr3283276buf.38.1204156917520; Wed, 27 Feb 2008 16:01:57 -0800 (PST) Received: by 10.82.186.16 with HTTP; Wed, 27 Feb 2008 16:01:57 -0800 (PST) Message-ID: <758d5e7f0802271601m592a932bh5916b10eccecbb4a@mail.gmail.com> Date: Thu, 28 Feb 2008 01:01:57 +0100 From: "Dawid Kuroczko" To: pgsql-sql Subject: Subselects returning array and ANY... MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200802/227 X-Sequence-Number: 30318 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