Howto convert / (re)store xml column to table in trigger using contrib/xml2?

From: Joost Kraaijeveld <J(dot)Kraaijeveld(at)Askesis(dot)nl>
To: pgsql-sql(at)postgresql(dot)org
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Howto convert / (re)store xml column to table in trigger using contrib/xml2?
Date: 2007-05-12 09:32:08
Message-ID: 1178962328.4937.8.camel@panoramix
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces pgsql-sql

Hi,

Is it possible to convert / (re)store a column that contains xml (see
below) into real table in a trigger, using contrib/xml2?

The reason is that an application stores a xml blob in a column but we
need the data in a real table for a third party report generator. So I
want to use a trigger that, upon insert, update or delete, moves the
data into that table.

The XML looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<data>
<field>
<name>field1</name>
<value>value1</value>
</field>
<field>
<name>field2</name>
<value>value2</value>
</field>
</data>

And I have a table with the (text) columns field1 and field2.

Any pointers to a solution is really appreciated (solutions also ;-))

TIA

--
Groeten,

Joost Kraaijeveld
Askesis B.V.
Molukkenstraat 14
6524NB Nijmegen
tel: 024-3888063 / 06-51855277
fax: 024-3608416
web: www.askesis.nl

Browse pgsql-interfaces by date

  From Date Subject
Next Message Michael Meskes 2007-05-12 11:35:35 Re: PQprepare question
Previous Message Rob Tester 2007-05-12 01:34:20 Help with returning a tuple

Browse pgsql-sql by date

  From Date Subject
Next Message Andreas 2007-05-12 23:40:59 Funny date-sorting task
Previous Message Fernando Hevia 2007-05-11 21:14:55 check_constraint and Extract not working?