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

Ignore when using COPY FROM

From: mkennedy(at)hssinc(dot)com (Matthew Kennedy)
To: pgsql-general(at)postgresql(dot)org
Subject: Ignore when using COPY FROM
Date: 2000-08-29 14:15:07
Message-ID: 39ABC56B.1A3F7F6A@opushealthcare.com (view raw or flat)
Thread:
Lists: pgsql-general
I have a ton of data in a text delimited file from an old legacy system.
When uploading it into postgres, I'd do something like this:

	COPY stuff FROM 'stuff.txt' USING DELIMITERS = '|';

The problem is some of the rows in stuff.txt may not conform to the
stuff table attributes (duplicate keys, for example). The command above
terminates with no change to the table stuff when it encounters an error
in stuff.txt. Is there a way to have postgres ignore erroneous fields
but keep information about which fields weren't processed. I believe
Oracle has some support for this through an IGNORE clause.

Responses

pgsql-general by date

Next:From: Trond Eivind =?iso-8859-1?q?Glomsr=F8d?=Date: 2000-08-29 14:27:31
Subject: Re: 7.1 Release Date
Previous:From: The Hermit HackerDate: 2000-08-29 12:05:25
Subject: Re: [GENERAL] cannot vacuum a database !

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