Re: Difference between char and varchar

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Franck Routier <franck(dot)routier(at)axege(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Difference between char and varchar
Date: 2006-08-29 21:07:19
Message-ID: 20060829210719.GA24393@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Tue, Aug 29, 2006 at 12:22:07 +0200,
Franck Routier <franck(dot)routier(at)axege(dot)com> wrote:
> Bruno Wolff III a écrit :
> >On Mon, Aug 28, 2006 at 15:04:26 -0400,
> > Richmond Dyes <rdyes(at)monroehosp(dot)org> wrote:
> >
> >>I know the difference between char and varchar is char is fixed length
> >>and varchar returns variable length. Which one should be used and why?
> >>
> >
> >You normally want to use 'text' instead of either 'char' or 'varchar'.
> >Unless there is a business rule limiting the length of a string (and
> >sometimes
> >not even then) you want to use 'text' as it is more flexible.
> >
> But it is not 'standard' sql, so it won't be portable to other
> databases, if needed.

I didn't think of that until after I sent the message. I should have listed
portability as a reason to user char or varchar.

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Richard Broersma Jr 2006-08-29 23:14:49 (FOR EACH STATEMENT AFTER UPDATE) Triggers & Transactions
Previous Message Andrej Ricnik-Bay 2006-08-29 18:12:35 Re: [GENERAL] Shared Objects (Dynamic loading)