Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 97BD4633522 for ; Thu, 16 Jul 2009 20:40:14 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 33503-03 for ; Thu, 16 Jul 2009 20:39:57 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by mail.postgresql.org (Postfix) with ESMTP id E6BE1632C8E for ; Thu, 16 Jul 2009 20:40:03 -0300 (ADT) Received: from root by ciao.gmane.org with local (Exim 4.43) id 1MRaYU-0001Pu-Kf for pgsql-sql@postgresql.org; Thu, 16 Jul 2009 23:40:02 +0000 Received: from g224121040.adsl.alicedsl.de ([92.224.121.40]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 16 Jul 2009 23:40:02 +0000 Received: from tim by g224121040.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 16 Jul 2009 23:40:02 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-sql@postgresql.org From: Tim Landscheidt Subject: Comparing a string against an XPath result set Date: Thu, 16 Jul 2009 21:19:56 +0000 Organization: Lines: 18 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: g224121040.adsl.alicedsl.de User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (gnu/linux) Cancel-Lock: sha1:MPZ+y2gL5zfketpKuHls8JuxG5I= X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200907/74 X-Sequence-Number: 32815 Hi, I'm trying to check whether a given string is part of an XPath result set. I have encountered some performance prob- lems in the process, but before I track those down further, I'd like to see if I've chosen the right path to begin with: | SELECT * FROM $TABLE | WHERE $COLUMN = ANY((xpath($EXPR, xmlparse(DOCUMENT $DOC)))::TEXT[]); In this case, xpath() returns an array of XML fragments made of a "pure" text child each. I cannot compare XML fragments with anything, so the conversion to TEXT[] seems to be the only way I could check whether $COLUMN is a part of those. Is there any other way I could tackle this? Tim