Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Yes it worked when I ommited the serial field in the copy command (and in
the import source file). As a reference for others:

COPY records (quad_id, species_id, observation_value) from
'/var/www/data/data_import2.csv' using delimiters ','  with null as ''; 

Karsten

 

> -----Original Message-----
> From: Tom Lane [mailto:tgl@xxxxxxxxxxxxx] 
> Sent: Friday, October 22, 2010 14:31
> To: karsten vennemann
> Cc: pgsql-general@xxxxxxxxxxxxxx
> Subject: Re:  auto fill serial id field with default 
> value in copy operation 
> 
> "karsten vennemann" <karsten@xxxxxxxxxxxx> 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


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux