Re: [GENERAL] Insertion of large xml files into PostgreSQL 10beta1 - Mailing list pgsql-general

From David G. Johnston
Subject Re: [GENERAL] Insertion of large xml files into PostgreSQL 10beta1
Date
Msg-id CAKFQuwY6egNyZAn+_gtHukhHZpze6GuAgEKp+fc639jQxZmRtA@mail.gmail.com
Whole thread Raw
In response to Re: [GENERAL] Insertion of large xml files into PostgreSQL 10beta1  (Alain Toussaint <atoussaint1976@gmail.com>)
Responses Re: [GENERAL] Insertion of large xml files into PostgreSQL 10beta1  (Alain Toussaint <atoussaint1976@gmail.com>)
List pgsql-general
On Sun, Jun 25, 2017 at 8:02 PM, Alain Toussaint <atoussaint1976@gmail.com> wrote:

echo "INSERT INTO samples (xmldata) VALUES $(cat
/srv/pgsql/pubmed/medline17n0001.xml)" | /usr/bin/psql medline
1>/dev/null 2>error.log

Typically I do:

--psql file
\set xmlcontent `cat 'projectblogs-categories.xml'`
INSERT INTO tbl (col) VALUES (:'xmlcontent');

though at the moment I cannot recollect whether the above munges whitespace.  I copied it from some json processing code where I wouldn't care if it did...

If you want to do something with INSERT/VALUES you should refresh yourself as to the syntax for the VALUES SQL Command.  Namely non-optional parentheses.

I'd also suggest you try to get a one or two line file importing correctly first.

David J.

pgsql-general by date:

Previous
From: Jan de Visser
Date:
Subject: Re: [GENERAL] Insertion of large xml files into PostgreSQL 10beta1
Next
From: Alain Toussaint
Date:
Subject: Re: [GENERAL] Insertion of large xml files into PostgreSQL 10beta1