From: Tom Lane <tgl@sss.pgh.pa.us>
To: henrik@steffen.stade.net
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] VARCHAR(50), CHAR(50) or TEXT ?
Date: Thu, 13 May 1999 10:11:32 -0400
Message-ID: <8550.926604692@sss.pgh.pa.us> (raw)
In-Reply-To: <373AB407.15E84C71@city-map.de>
Henrik Steffen <webmaster@city-map.de> writes:
> But, what is the difference between VARCHAR and TEXT ?
Almost none. VARCHAR won't let you go beyond the stated maximum length,
whereas TEXT has no specific upper limit. Otherwise they are stored
in exactly the same way. (At least in Postgres ... dunno about other
DBMSs.)
I'd be inclined to use TEXT unless the maximum length were really an
important part of the semantics of the data for my application. If
you find yourself saying "Well, I *think* it'll never go beyond N
characters, but maybe I should add a little slop for safety" then
I'd say forget all about VARCHAR and use TEXT. If you find yourself
saying "it *had better not* go beyond N characters, because that
app over there will crash if it does" then use VARCHAR to enforce the
limit.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, henrik@steffen.stade.net
Subject: Re: [SQL] VARCHAR(50), CHAR(50) or TEXT ?
In-Reply-To: <8550.926604692@sss.pgh.pa.us>
References: <373AB407.15E84C71@city-map.de> <8550.926604692@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox