Re: Copy and xml files

From: Guy Fraser <guy(at)incentre(dot)net>
To: cgg007(at)yahoo(dot)com
Cc: C G <csgcsg39(at)hotmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Copy and xml files
Date: 2004-02-04 17:54:49
Message-ID: 402131E9.3050102@incentre.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Chris Gamache wrote:

>COPY works for whole tables, and can't append rows. ...
>
>
Wrong!

I use copy regularly to add data to a table.

...snip...

>--- C G <csgcsg39(at)hotmail(dot)com> wrote:
>
>
>>Dear All,
>>
>>I'm trying to insert an xml file into my database. I have a table with a
>>single text column. My intention is just to have the xml file take up one
>>row in the table.
>>
>>I've tried the command
>>
>>COPY t1 FROM '/tmp/file.xml';
>>
>>but keep getting the error message
>>
>>ERROR: extra data after last expected column
>>CONTEXT: COPY t1, line 32: " <cn type="integer"> 1 </cn>"
>>
>>Thanks for any help
>>
>>Colin
>>
>>
If you are trying to import the whole file into one 'column' of a table, you will need to escape the "end of line" [carriage return/line feed] characters.

I believe this question has been asked many times, and the method of importing this type of data is in the archives.

Please check the archives.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Hervé Piedvache 2004-02-04 20:45:59 Predictive or scoring solution for PostgreSQL ?
Previous Message John Sidney-Woollett 2004-02-04 17:11:14 Re: Resize varchar column