Re: import XML

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: PASCAL CROZET <pascal(dot)crozet(at)qualis-consulting(dot)com>
Cc: PG-General Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: Re: import XML
Date: 2020-08-18 15:38:39
Message-ID: CAKFQuwaZu9w74XOPgsMYQ_yPwiXOYd=_bHXD2F5yGF0zxrLh8Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Aug 18, 2020 at 8:27 AM PASCAL CROZET <
pascal(dot)crozet(at)qualis-consulting(dot)com> wrote:

> I want to import XML file into PG database table.
> I've find functions to get the XML content of a cell after imported an XML
> file with the pg_get_file function.
> But, I want to explode the XML content to colums. How can I do this ?
>

In short, you need to import the content as a document value first then use
functions to explode that document.

You should find the documentation helpful.

https://www.postgresql.org/docs/10/functions-xml.html

Specifically, "xmltable"

Keep in mind that "context as a document value" can just be a literal.

David J.

In response to

  • import XML at 2020-08-18 15:27:46 from PASCAL CROZET

Browse pgsql-general by date

  From Date Subject
Next Message Peter Geoghegan 2020-08-18 16:44:08 Re: Index tuple deduplication limitations in pg13
Previous Message PASCAL CROZET 2020-08-18 15:27:46 import XML