Re: Limited varchar, unlimited varchar, or text?

Поиск
Список
Период
Сортировка
От Dmitry Tkach
Тема Re: Limited varchar, unlimited varchar, or text?
Дата
Msg-id 3F1FF416.5090700@openratings.com
обсуждение исходный текст
Ответ на Limited varchar, unlimited varchar, or text?  (Curtis Hawthorne <mr_person@mrperson.org>)
Список pgsql-general
Curtis Hawthorne wrote:

>Hi,
>
>I'm setting up a table for a new project and have a question about choosing a
>data type for one of the columns.  It will be for a username that is retrieved
>from an LDAP server.  I know that I'll want to use either varchar or text.
>The problem with using varchar is I don't know for sure how long the username
>may be and I don't like just picking a large number for the limit and hoping I
>don't need to change it in the future.  After looking at the docs on the
>character datatypes I noticed that if you don't specify a limit on the varchar
>type it will accept strings of any length.  If that's the case, what's the
>difference between it and text?
>
>According the the page there's no performance difference between the types so
>I would lean towards using unlimited varchar or text to avoid having an
>arbitrary limit, but are there any other hidden problems with using these
>types?  If not, which one should I use?
>
>
>
No :-)
Just use text.
The only difference between text and varchar(10) is that the latter will
not let you insert strings longer than 10 characters.

Dima



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: quoting of array elements + sexp_out?
Следующее
От: "scott.marlowe"
Дата:
Сообщение: Re: Limited varchar, unlimited varchar, or text?