Re: ALTER Bigserial error - Mailing list pgsql-general

From Tom Lane
Subject Re: ALTER Bigserial error
Date
Msg-id 6811.1272221404@sss.pgh.pa.us
Whole thread Raw
In response to ALTER Bigserial error  ("Little, Douglas" <DOUGLAS.LITTLE@orbitz.com>)
Responses Re: ALTER Bigserial error  ("Little, Douglas" <DOUGLAS.LITTLE@orbitz.com>)
List pgsql-general
"Little, Douglas" <DOUGLAS.LITTLE@orbitz.com> writes:
> I'm trying to alter in a bigserial on GP/PG 8.1  I'm getting the error

> ERROR: type "bigserial" does not exist
> SQL state: 42704

> I understand that bigserial isn't a 'true' type, that it's a notational convenience.
> And that I can alter in the default.

> But it is listed in the type table in the doc and I can create new tables with it.
> I should be able to use it in an alter.
> Is there a way to fix this bug?

It isn't a bug; it could be argued to be a missing feature, but I don't
think it's very high on anyone's priority list to add.  Before anything
could happen here there would need to be consensus on how to behave in
all the various corner cases.  For instance, should the ALTER override
any pre-existing default expression for the column?  If there's not
already a sequence associated with the column, what initial value should
it be created with?  Should the ALTER make any attempt to check or
correct the data in the column?

The only case that seems to me to not have some debatable behavior
involved is widening an existing serial column --- and you can do that
now with "ALTER TYPE bigint".  Since serial/bigserial are just macros
for column properties that you can set explicitly, it's always possible
to get where you want to go with lower-level operations; and those
operations give you full control over what happens, whereas a
packaged-up "ALTER TYPE bigserial" operation wouldn't.

            regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Plpgsql function syntax error at first coalesce statement
Next
From: Samuel
Date:
Subject: Re: Help me stop postgres from crashing.