Re: ALTER TABLE with TYPE serial does not work

From: Andreas Wenk <a(dot)wenk(at)netzmeister-st-pauli(dot)de>
To: Richard Broersma <richard(dot)broersma(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: ALTER TABLE with TYPE serial does not work
Date: 2009-02-01 20:16:17
Message-ID: 49860311.5020805@netzmeister-st-pauli.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Richard Broersma schrieb:
> On Sat, Jan 31, 2009 at 3:16 PM, Andreas Wenk
> <a(dot)wenk(at)netzmeister-st-pauli(dot)de> wrote:
>
>> Why does this not work:
>>
>> postgres=# ALTER TABLE tab1 ALTER COLUMN nr TYPE serial;
>> ERROR: type "serial" does not exist
>
> serial is really just "short-hand" for making an integer column use
> default incrementing function. The following will fully explain what
> it is so that you can alter the column:
> http://www.postgresql.org/docs/8.3/interactive/datatype-numeric.html#DATATYPE-SERIAL
>
>

Thanks Richard, that helped. I thought maybe there is another reason
because when I create a table and use serial as "type" (like I would
when I use integer) it works well. I know that searial is just for my
convenience as written in the manual. I failed to understand, that it is
not really a type.

Cheers

Andy

--
St.Pauli - Hamburg - Germany

Andreas Wenk

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andreas Wenk 2009-02-01 20:23:30 Re: ALTER TABLE with TYPE serial does not work
Previous Message Adam Rich 2009-02-01 20:15:16 Re: Pet Peeves