Limited varchar, unlimited varchar, or text? - Mailing list pgsql-general

From Curtis Hawthorne
Subject Limited varchar, unlimited varchar, or text?
Date
Msg-id hiieun.xmekb6@webmail.remnetworks.org
Whole thread Raw
Responses Re: Limited varchar, unlimited varchar, or text?  (Dmitry Tkach <dmitry@openratings.com>)
Re: Limited varchar, unlimited varchar, or text?  (Dmitry Tkach <dmitry@openratings.com>)
List 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 by date:

Previous
From: "Vernon Smith"
Date:
Subject: Re: SAP DB: The unsung Open Source DB
Next
From: Mike Mascari
Date:
Subject: Re: SAP DB: The unsung Open Source DB