Limited varchar, unlimited varchar, or text?

Поиск
Список
Период
Сортировка
От Curtis Hawthorne
Тема Limited varchar, unlimited varchar, or text?
Дата
Msg-id hiieun.xmekb6@webmail.remnetworks.org
обсуждение исходный текст
Ответы Re: Limited varchar, unlimited varchar, or text?  (Dmitry Tkach <dmitry@openratings.com>)
Re: Limited varchar, unlimited varchar, or text?  (Dmitry Tkach <dmitry@openratings.com>)
Список pgsql-general
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?

Thanks!

Curtis H.




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

Предыдущее
От: "Vernon Smith"
Дата:
Сообщение: Re: SAP DB: The unsung Open Source DB
Следующее
От: Mike Mascari
Дата:
Сообщение: Re: SAP DB: The unsung Open Source DB