Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id DD9AF9FB35D; Sat, 12 May 2007 07:01:50 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 01511-09; Sat, 12 May 2007 07:01:42 -0300 (ADT) X-Greylist: delayed 00:29:23.596416 by SQLgrey-1.7.4 X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 8F6739FB34D; Sat, 12 May 2007 07:01:45 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from obelix.askesis.nl (laudanum.demon.nl [82.161.125.16]) by svr4.postgresql.org (Postfix) with ESMTP id 5C5FD5AF024; Sat, 12 May 2007 09:32:20 +0000 (GMT) Received: obelix 172.31.0.1 from 172.31.1.1 172.31.1.1 via HTTP with MS-WebStorage 6.0.6249 Received: from panoramix by obelix; 12 May 2007 11:32:08 +0200 Subject: Howto convert / (re)store xml column to table in trigger using contrib/xml2? From: Joost Kraaijeveld To: pgsql-sql@postgresql.org Cc: pgsql-interfaces@postgresql.org Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Sat, 12 May 2007 11:32:08 +0200 Message-Id: <1178962328.4937.8.camel@panoramix> Mime-Version: 1.0 X-Mailer: Evolution 2.6.3 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.177 tagged_above=0 required=5 tests=AWL=0.040, BAYES_50=0.001, FORGED_RCVD_HELO=0.135, UNPARSEABLE_RELAY=0.001 X-Spam-Level: X-Archive-Number: 200705/18 X-Sequence-Number: 6525 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: field1 value1 field2 value2 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