Re: PK/FK impacts using text data type

Поиск
Список
Период
Сортировка
От David G Johnston
Тема Re: PK/FK impacts using text data type
Дата
Msg-id 1420917948381-5833533.post@n5.nabble.com
обсуждение исходный текст
Ответ на Re: PK/FK impacts using text data type  (Albe Laurenz <laurenz.albe@wien.gv.at>)
Список pgsql-admin
Albe Laurenz *EXTERN* wrote
> Denise Ferrell wrote:
>> We have been discussing whether or not to change all of our varchar
>> (character varying)
>> data types to text for ease of use in procedures/functions/triggers...
>>
>> Are there any impacts on keys by using text data type vs. character
>> varying or character varying(n)?
>
> The only useful thing about varchar is that it imposes a length constraint
> on a database field.
>
> Values used for indexing have a length limit, so if you change an indexed
> column to text
> somebody could try to insert values that will cause errors because the
> limit has been exceeded.
>
> Also you application code cannot rely on a certain size limit any more.
>
> If you are ok with that, go ahead and use text.
>
> Yours,
> Laurenz Albe

Appropriate check constraints can handle the majority of the needed cases.
In theory, domains would be helpful here too but I'm not totally conversant
on them at the moment.

David J.



--
View this message in context: http://postgresql.nabble.com/PK-FK-impacts-using-text-data-type-tp5833407p5833533.html
Sent from the PostgreSQL - admin mailing list archive at Nabble.com.


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: PK/FK impacts using text data type
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: pg_upgrade from V9.3.3 to V9.4.0