Re: determine sequence name for a serial

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: determine sequence name for a serial
Дата
Msg-id 87u0seqtx4.fsf@stark.xeocode.com
обсуждение исходный текст
Ответ на Re: determine sequence name for a serial  ("Ed L." <pgsql@bluepolka.net>)
Ответы Re: determine sequence name for a serial  (Alvaro Herrera <alvherre@dcc.uchile.cl>)
Список pgsql-general
"Ed L." <pgsql@bluepolka.net> writes:

> In PostgreSQL, at least for the past 5 years if not longer, if you create a
> SERIAL column for (schemaname, tablename, columnname), then your sequence
> will *always* be "schemaname.tablename_columnname_seq". If that naming
> convention changes, there will be a whole lotta breakage world-wide.

I hope you're wrong about people expecting that to be true because it isn't.
The resulting sequence name is limited to 63 characters and gets truncated if
it goes over. (63!? was it intended to be 64?) I believe the limit used to be
32 characters too.

In any case it's just plain good design to avoid unnecessary
interrelationships between different parts of the code. Practically speaking
it makes renaming something not involve an error-prone search and replace.
More importantly it makes it easier to verify that a piece of code is correct
without having to hunt down all the related bits to be sure the relationships
are correct. It also makes it possible to reuse or refactor the code.

--
greg

В списке pgsql-general по дате отправления:

Предыдущее
От: "Ed L."
Дата:
Сообщение: Re: determine sequence name for a serial
Следующее
От: Jerry LeVan
Дата:
Сообщение: Upgrading from beta3 to beta4