Re: [GENERAL] auto fill serial id field with default value in copy operation

2010-10-22 Thread karsten vennemann
en > -Original Message- > From: Tom Lane [mailto:t...@sss.pgh.pa.us] > Sent: Friday, October 22, 2010 14:31 > To: karsten vennemann > Cc: pgsql-general@postgresql.org > Subject: Re: [GENERAL] auto fill serial id field with default > value in copy operation > >

Re: [GENERAL] auto fill serial id field with default value in copy operation

2010-10-22 Thread Tom Lane
"karsten vennemann" writes: > What is the best way to load my data via copy into the db and get the > record_id field auto filled (with the next id value in squence) ? You have to omit the column from the copy data altogether, and then list just the columns that are supplied in the data in the C

[GENERAL] auto fill serial id field with default value in copy operation

2010-10-22 Thread karsten vennemann
I'm trying to load data from a csv file via copy command into a table with the first column record_id specified NOT NULL (this is a serial field defined as follows: ALTER TABLE records ADD COLUMN record_id integer; ALTER TABLE records ALTER COLUMN record_id SET STORAGE PLAIN; ALTER TABLE recor