Re: How to import XML large file in Postgresql

From: "Gunnar \"Nick\" Bluth" <gunnar(dot)bluth(at)pro-open(dot)de>
To: pgeu-general(at)postgresql(dot)org
Subject: Re: How to import XML large file in Postgresql
Date: 2016-06-23 23:37:09
Message-ID: 3e6c5478-70ff-d7d8-c330-c142c7326711@pro-open.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgeu-general

Am 23.06.2016 um 22:24 schrieb Gennaro Sivero:
> Hello
>
> I need to import an XML large file into a database table .
>
> I've created a table with the following command:
>
> |CREATE TABLE mytable(xmldata xml)|
>
> A file containing data is on my desktop. How would I import this file
> into my table?
>
> Is there an existing utility, like SQLLoader in Oracle that does this?
>

Hi Gennaro,

of course there are tools (though I'm not too familiar with them), but -
depending on what you call "large" - you might do well with this in a
simple psql session:
# \set largexmlfile `cat INSERTFILENAMEHERE`
# INSERT INTO mytable (xmldata) VALUES (:largexmlfile);

Obviously, this will probably not work with _really_ large files... in
that case, COPY or \copy with no delimiter might work.

Hope that helps,
--
Gunnar "Nick" Bluth
RHCE/SCLA

Mobil +49 172 8853339
Email: gunnar(dot)bluth(at)pro-open(dot)de
_____________________________________________________________
In 1984 mainstream users were choosing VMS over UNIX.
Ten years later they are choosing Windows over UNIX.
What part of that message aren't you getting? - Tom Payne

Attachment Content-Type Size
0x3289338C.asc application/pgp-keys 1.7 KB

In response to

Responses

Browse pgeu-general by date

  From Date Subject
Next Message Christoph Berg 2016-06-24 08:37:57 Re: How to import XML large file in Postgresql
Previous Message Gennaro Sivero 2016-06-23 20:24:18 How to import XML large file in Postgresql