From: | Dmitry Tkach <dmitry(at)openratings(dot)com> |
---|---|
To: | Curtis Hawthorne <mr_person(at)mrperson(dot)org> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Limited varchar, unlimited varchar, or text? |
Date: | 2003-07-24 14:58:30 |
Message-ID: | 3F1FF416.5090700@openratings.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Dmitry Tkach | 2003-07-24 15:04:09 | Re: Limited varchar, unlimited varchar, or text? |
Previous Message | Tom Lane | 2003-07-24 14:42:24 | Re: psql -e |