Copy Error Msgs - Mailing list pgsql-general

From Geoff Russell
Subject Copy Error Msgs
Date
Msg-id Pine.GSO.4.05.10002101656100.25475-100000@blaze
Whole thread Raw
List pgsql-general
Hi,

I'm converting a data set from a btree file to a PostgreSQL file by
converting to text in COPY format and then using COPY.

My problem is that there is some bad data in the file. Not really bad, but
bad enough for the copy to fail.

e.g., trying to load a blank into a field I've declared as bool is
enough to cause the copy to fail - and nicely undo itself, so at the
end of loading 100000 records I find I have an empty data base.

I don't really object to the copy failing, but it does so silently. If
I try with a small file containing the offending record (the finding of
which was not easy!) then I get a brief (but adequate) error message,
but the message disappears when I embed the bad record in with 10000
or more other records.

I've got a file called XXX:

             COPY "table" FROM stdin;
             ... data
             ... ~100000 records (I've been testing with 5000)
             ...
             \.

and I say "psql -e dbname < XXX"

If someone can suggest a more friendly way of doing this, I'd be grateful.

Cheers,
Geoff Russell

P.S. Yes, I will clean up the data, but I always thought a blank was a
pretty good false value (yes, I do use perl!).

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6 Fifth Ave           +618-8332-5069 (Home)          |
St Morris SA 5068     +618-8207-2029 (Work)          | geoff@austrics.com.au
Adelaide, AUSTRALIA   +618-8364-1543 (Fax-Home)      |


pgsql-general by date:

Previous
From: Ed Loehr
Date:
Subject: Re: [GENERAL] How can we do STORED PRECEDURE in PostgreSQL?
Next
From: "Sanjay Minni"
Date:
Subject: features of PGSQL