Problems importing data from plain text file

From: Mário Gamito <gamito(at)netual(dot)pt>
To: pgsql-general(at)postgresql(dot)org
Subject: Problems importing data from plain text file
Date: 2004-09-07 14:58:22
Message-ID: 413DCC8E.3000800@netual.pt
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I have this plain text file with about 5000 lines.
Each line may have 4 or 5 fields, all delimited with a tab.

I've made a table named t_zip_codes with 5 fields.

When i run (in postgres command line) the command

COPY t_zip_code FROM zip_codes.txt;

it aborts as soon as it reaches a line with only 4 fields in the text
file, because the table t_zip_codes have 5 fields.

How can i solve this annoyance ?
All my fields are character varying.

Any help would be appreciated.

Warm regards,
Mário Gamito

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dan Sugalski 2004-09-07 15:00:48 Re: explain with placeholders?
Previous Message Dino Vliet 2004-09-07 14:54:49 Re: error: insert has more expressions than target column