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

Re: COPY command and serial columns

From: Jasen Betts <jasen(at)xnet(dot)co(dot)nz>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: COPY command and serial columns
Date: 2010-11-07 10:55:24
Message-ID: ib60is$qdi$1@reversiblemaps.ath.cx (view raw or flat)
Thread:
Lists: pgsql-novice
On 2010-11-05, Wm.A.Stafford <stafford(at)marine(dot)rutgers(dot)edu> wrote:
> I am trying to use COPY to load some data.  I am not using a list of 
> column names in the COPY command.  The table I am loading has 80 
> character varying columns and a primary key defined as: id serial 
> PRIMARY KEY
>
> The id field is not in the data being loaded so COPY gives the message:
> ERROR:  missing data for column "id"
>
> I don't want to use a column list because this table is subject to a lot 
> of change and a column list would be yet another possible point of 
> failure if it has to be changed to keep up with table changes.
>
> Is there anyway to load this data without specifying a column list?

a: drop the column, load the data, re-add the column.

b: load the data into a temporary first.

c: otherwise "no"


-- 
ɹǝpun uʍop ɯoɹɟ sƃuıʇǝǝɹ⅁


In response to

pgsql-novice by date

Next:From: Jasen BettsDate: 2010-11-07 11:00:38
Subject: Re: Data Types
Previous:From: Tom LaneDate: 2010-11-07 00:15:30
Subject: Re: migrating from linux to Windows

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