Thread: Database conversion type serial question

Database conversion type serial question

From
Carol Walter
Date:
I'm converting a database developed by a group of students from
Oracle to Postgres.  There are fields that should be primary keys
using sequences.  I can get the primary keys designated but when I
try to change the type from integer to serial I get an error saying
that 'type "serial" does not exist.  Can I designate a column not
previously defined as serial to serial.  It was a sequence on the
Oracle database that I'm converting it from.

Carol

Re: Database conversion type serial question

From
Tom Lane
Date:
Carol Walter <walterc@indiana.edu> writes:
> Can I designate a column not
> previously defined as serial to serial.

"serial" is not really a type.  It's just a convenience macro for
creating a sequence and setting the column's default expression.
So what you do is perform those steps manually.  See
http://www.postgresql.org/docs/8.2/static/datatype-numeric.html#DATATYPE-SERIAL

            regards, tom lane