Re: Serial Data Type
| От | Tom Lane |
|---|---|
| Тема | Re: Serial Data Type |
| Дата | |
| Msg-id | 23207.1207198841@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Re: Serial Data Type ("Adam Rich" <adam.r@sbcglobal.net>) |
| Список | pgsql-general |
"Adam Rich" <adam.r@sbcglobal.net> 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
В списке pgsql-general по дате отправления: