Search Postgresql Archives

Re: Serial Data Type

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

 



"Adam Rich" <adam.r@xxxxxxxxxxxxx> writes:
>> I have just created a table using SELECT INTO however the PK was
>> supposed to be a serial. It is now an integer. To make it a serial I
>> just create the seq and set the default to be the nextval() of that
>> sequence right? is there anything else I need to do? 

> You'll want to do this:
> ALTER SEQUENCE table_col_id_seq OWNED BY table.col_id;
> http://www.postgresql.org/docs/8.3/interactive/sql-altersequence.html

That's correct as far as it goes, but the OP might benefit more from
reading the description of what a "serial" column really is:

http://www.postgresql.org/docs/8.3/interactive/datatype-numeric.html#DATATYPE-SERIAL

			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