Skip site navigation (1) Skip section navigation (2)

Problems importing data

From: Devin Whalen <devin(at)synapticvision(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Problems importing data
Date: 2004-08-20 15:17:41
Message-ID: 1093015060.2335.22.camel@192.168.1.80 (view raw or flat)
Thread:
Lists: pgsql-sql
Hey,

I am exporting data from one database and importing into another
database.  I dump the data from one database like so:

pg_dump dbname -R -a -f exportFile.sql

I then import the data using:
psql import_db -f exportFile.sql 1>>import_sql 2>>import_errorlog

However, when I do the import my import_errorlog gets filled with these
errors:

This is the big one.  It seems to happen thousands and thousands of
times!!
psql:exportFile.sql:196563: invalid command \N
I don't know why it keeps happening!


These two are similar and I think...correct me if I am wrong...is caused
because there is a \r or a \t in a data field (probably a text field)
and this is confusing psql.  But how do I get around this??  Do a search
and replace on \r and \t??  There must be a better way?
psql:exportFile.sql:196563: \r: extra argument "(416)" ignored
psql:exportFile.sql:203889: \t: extra argument "TNSA:" ignored

This is part of a sample data line where the above error occurs:
\N      please ask for Frank Junior fr confirmation \r\n\r      (416)
743-7378  \N      \N      s


This is another one.  I think it happens when a table has no info in it
but shouldn't psql be able to handle this??
psql:exportFile.sql:97720: invalid command \.

This is sample data for the above error.
COPY getnext (client) FROM stdin;
\.


One way around these errors  *I guess*, is to export all the data as
inserts with column names...but this takes forever because I have a lot
of data.  Any suggestions would be appreciated.

Later


-- 
Devin Whalen
Programmer
Synaptic Vision Inc
Phone-(416) 539-0801
Fax- (416) 539-8280
1179A King St. West
Toronto, Ontario
Suite 309 M6K 3C5
Home-(416) 653-3982

pgsql-sql by date

Next:From: SVGK, Raju (Raju)Date: 2004-08-20 15:55:54
Subject: view triggers/procedures
Previous:From: Stephan SzaboDate: 2004-08-20 15:04:13
Subject: Re: multi column foreign key for implicitly unique columns

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group