Search Postgresql Archives

Re: Import id column then convert to SEQUENCE?

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

 



On Thu, Dec 9, 2010 at 10:56 PM, Shoaib Mir <shoaibmir@xxxxxxxxx> wrote:
> I guess I misread it... use the following:
>
> - Import all the data into say an integer column.
> - Now create a sequence and give it a start value of where your import
> ended.
> - Make the default value for the column using the new sequence.
>

create the table with a SERIAL column, which will make the sequence
and set the auto increment default as you wanted.

import the data

update the sequence with setval() to the next highest value you want
it to return, usually max()+1 of the populated column.

-- 
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