Re: ALTER Bigserial error

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: ALTER Bigserial error
Дата
Msg-id 6811.1272221404@sss.pgh.pa.us
обсуждение исходный текст
Ответ на ALTER Bigserial error  ("Little, Douglas" <DOUGLAS.LITTLE@orbitz.com>)
Ответы Re: ALTER Bigserial error  ("Little, Douglas" <DOUGLAS.LITTLE@orbitz.com>)
Список 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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Plpgsql function syntax error at first coalesce statement
Следующее
От: Samuel
Дата:
Сообщение: Re: Help me stop postgres from crashing.