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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "karsten vennemann" <karsten(at)terragis(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: auto fill serial id field with default value in copy operation
Date: 2010-10-22 21:31:11
Message-ID: 29409.1287783071@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"karsten vennemann" <karsten(at)terragis(dot)net> 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 COPY command's
column list.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gary Chambers 2010-10-22 21:51:10 Re: Solaris install - "cannot compute sizeof (off_t)" error - readline issue?
Previous Message karsten vennemann 2010-10-22 21:03:47 auto fill serial id field with default value in copy operation