Re: A modest proposal for a FAQ addition

From: Ian Barwick <barwick(at)gmx(dot)net>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: A modest proposal for a FAQ addition
Date: 2003-01-12 11:06:09
Message-ID: 200301121206.09081.barwick@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sunday 12 January 2003 06:17, Bruce Momjian wrote:
> Tom Lane wrote:
> > Q: Why do I get strange results with a CHAR(n) field?
> >
> > A. Don't use CHAR(n). VARCHAR(n) has the behavior you are probably
> > expecting; on top of which it's more compact and usually faster.
> >
> >
> > I suppose the above needs some fleshing out, but man am I getting tired
> > of explaining about significant vs non-significant trailing blanks.
>
> OK, good point. I was mentioning CHAR() in the FAQ entry first, while
> it should have been mentioned later. I also added a specific mention of
> the trailing spaces issue. Patch attached.

Err, from the patch:

"CHAR(n) stores trailing spaces, while VARCHAR(n) trims them."

Surely this should read something like:

"CHAR(n) automatically pads strings with trailing blanks to the defined
column length."

Ian Barwick
barwick(at)gmx(dot)net

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andreas Joseph Krogh 2003-01-12 12:28:10 Roadmap for 7.4
Previous Message Bruce Momjian 2003-01-12 05:17:13 Re: A modest proposal for a FAQ addition