Comparing a string against an XPath result set

From: Tim Landscheidt <tim(at)tim-landscheidt(dot)de>
To: pgsql-sql(at)postgresql(dot)org
Subject: Comparing a string against an XPath result set
Date: 2009-07-16 21:19:56
Message-ID: m3ljmocolf.fsf@passepartout.tim-landscheidt.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

Browse pgsql-sql by date

  From Date Subject
Next Message Christophe 2009-07-17 03:07:09 De-duplicating rows
Previous Message Emi Lu 2009-07-14 18:52:38 Re: Request new version to support "on commit drop" for create temp table ... as select ?