Limited varchar, unlimited varchar, or text?

From: Curtis Hawthorne <mr_person(at)mrperson(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Limited varchar, unlimited varchar, or text?
Date: 2003-07-24 03:25:35
Message-ID: hiieun.xmekb6@webmail.remnetworks.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Mike Mascari 2003-07-24 03:42:06 Re: SAP DB: The unsung Open Source DB
Previous Message Vernon Smith 2003-07-24 03:01:14 Re: SAP DB: The unsung Open Source DB