Re: Insertion of large xml files into PostgreSQL 10beta1

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Alain Toussaint <atoussaint1976(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Insertion of large xml files into PostgreSQL 10beta1
Date: 2017-06-29 04:13:07
Message-ID: CAKFQuwY6egNyZAn+_gtHukhHZpze6GuAgEKp+fc639jQxZmRtA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, Jun 25, 2017 at 8:02 PM, Alain Toussaint <atoussaint1976(at)gmail(dot)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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alain Toussaint 2017-06-29 05:45:53 Re: Insertion of large xml files into PostgreSQL 10beta1
Previous Message Jan de Visser 2017-06-29 02:32:33 Re: Insertion of large xml files into PostgreSQL 10beta1