Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 468B56325F3 for ; Mon, 29 Mar 2010 19:34:17 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 66228-02 for ; Mon, 29 Mar 2010 22:33:58 +0000 (UTC) Received: from news.hub.org (news.hub.org [200.46.204.72]) by mail.postgresql.org (Postfix) with ESMTP id 855B1632269 for ; Mon, 29 Mar 2010 19:34:04 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.14.3/8.14.3) with ESMTP id o2TMY3dU041634 for ; Mon, 29 Mar 2010 19:34:03 -0300 (ADT) (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.14.3/8.14.3/Submit) id o2TMHCsL036217 for pgsql-sql@postgresql.org; Mon, 29 Mar 2010 19:17:12 -0300 (ADT) (envelope-from news) From: Joseph S X-Newsgroups: pgsql.sql Subject: How do I search a two dimensional array? Date: Mon, 29 Mar 2010 18:17:11 -0400 Organization: Hub.Org Networking Services Lines: 38 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Thunderbird 2.0.0.23 (X11/20090812) To: pgsql-sql@postgresql.org X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.219 tagged_above=-10 required=5 tests=AWL=-0.220, BAYES_50=0.001 X-Spam-Level: X-Archive-Number: 201003/212 X-Sequence-Number: 33919 I can search a one dimensional array with SELECT value = ANY(array), but how do I search two dimensional array for a particular row? ANY seems to flatten out a two dimensional array. [local]:playpen=> select 2 = any (ARRAY[[1,7],[4,2]]); ?column? ---------- t (1 row) Time: 52.451 ms [local]:playpen=> select ROW(2,7) = any (ARRAY[[1,7],[4,2]]); ERROR: operator does not exist: record = integer LINE 1: select ROW(2,7) = any (ARRAY[[1,7],[4,2]]); ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. [local]:playpen=> select ROW(4,2) = any (ARRAY[[1,7],[4,2]]); ERROR: operator does not exist: record = integer LINE 1: select ROW(4,2) = any (ARRAY[[1,7],[4,2]]); ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. [local]:playpen=> [local]:playpen=> [local]:playpen=> select ARRAY[2,7] = ANY( ARRAY[[1,7],[4,2],[6,8]]); ERROR: operator does not exist: integer[] = integer LINE 1: select ARRAY[2,7] = ANY( ARRAY[[1,7],[4,2],[6,8]]); ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. [local]:playpen=> select ARRAY[1,7] = any ( ARRAY[[1,7],[4,2],[6,8]]); ERROR: operator does not exist: integer[] = integer LINE 1: select ARRAY[1,7] = any ( ARRAY[[1,7],[4,2],[6,8]]); ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. [local]:playpen=>