Re: User-Defined Types

Поиск
Список
Период
Сортировка
От Michael Glaesemann
Тема Re: User-Defined Types
Дата
Msg-id 22C28D3C-52D8-40CF-8A46-D48FAE69940C@seespotcode.net
обсуждение исходный текст
Ответ на User-Defined Types  ("David F. Johnson" <dfjohnson@cabaret.com>)
Список pgsql-general
On Jul 5, 2007, at 15:53 , David F. Johnson wrote:

> During the development of a database often there is a need to change a
> field's declaration from, say, VARCHAR(32) to, say, VARCHAR(64).

> Is there a simple way to make a user-defined type that is a specific
> declaration of a built-in type (like VARCHAR(##)) without having to
> implement the type's support functions?

In PostgreSQL there's no performance advantage to limiting a varchar.
I'd recommend making all of your references to any varchar columns
not include a limit (i.e., just text or varchar), and perhaps setting
the referenced column as text with a length check constraint if one
is needed to satisfy some business rule. Then you can easily alter
the allowed length by altering the check constraint. (Similarly you
could use varchar(n) on the referenced column as well, and then just
ALTER TABLE ALTER TYPE instead of altering the check constraint. I
don't know if one has a performance advantage in checking the length
of the value.)


Michael Glaesemann
grzm seespotcode net



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

Предыдущее
От: "Tim Olsen"
Дата:
Сообщение: Re: dropdb ; createdb equivalent without createdb permission?
Следующее
От: "Alexander Staubo"
Дата:
Сообщение: Re: Performance Question - Table Row Size