Re: PSQL Data Type: text vs. varchar(n)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Uwe C(dot) Schroeder" <uwe(at)oss4u(dot)com>
Cc: pgsql-general(at)postgresql(dot)org, Chris <dmagick(at)gmail(dot)com>, kurt _ <kjs216(at)hotmail(dot)com>
Subject: Re: PSQL Data Type: text vs. varchar(n)
Date: 2006-03-31 05:51:31
Message-ID: 3680.1143784291@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Uwe C. Schroeder" <uwe(at)oss4u(dot)com> writes:
> On Thursday 30 March 2006 21:27, Tom Lane wrote:
>> My own take on this is that you should "say what you mean". If you do
>> not have a clear application-oriented reason for specifying a particular
>> limit N in varchar(N), you have no business choosing a random value of N
>> instead. Use text, instead of making up an N.

> Tom, good point. However, if you design an application that at one point
> _might_ need to be run on something else than postgres (say oracle or DB2),
> your're way better off with a varchar than text.

Well, if you are looking for the lowest-common-denominator textual
column datatype, then varchar(255) is probably it ... I think even Bill
Gates would feel ashamed to sell a database that could not handle that.
But my reading of the OP's question was about whether there's a usefully
large value of N for which every available DB will take "varchar(N)".
I'm not real sure what the practical limit of N is in that question,
other than being pretty confident that Postgres isn't holding down
last place. Comments anyone?

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Chris 2006-03-31 05:55:36 Re: PSQL Data Type: text vs. varchar(n)
Previous Message Uwe C. Schroeder 2006-03-31 05:37:32 Re: PSQL Data Type: text vs. varchar(n)