Re: [GENERAL] 'a' == 'a '

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Dann Corbit <DCorbit(at)connx(dot)com>, Richard_D_Levine(at)raytheon(dot)com, general(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [GENERAL] 'a' == 'a '
Date: 2005-10-25 03:09:39
Message-ID: 8883.1130209779@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> OK, I understand now. It is tempting to think that the difference
> between char() and varchar() is that internally they use a different
> collating sequences, but that isn't the case. If it were, space would
> be ignored during comparisons any place in the string, when in fact, is
> it is only trailing space that char() ignores, e.g.:

No, you don't understand. The standard defines PAD SPACE as making
*trailing* spaces irrelevant to comparisons, not embedded or leading
spaces. And they regard PAD SPACE as an attribute of a collation rather
than of the string datatype. This seems pretty wacko to me (in
particular it's hard to see how NO PAD is useful with char(N) storage)
but that's what they did.

> What additional documentation is needed?

Some specific discussion of the relationship to the standard would be
helpful, perhaps.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruno Wolff III 2005-10-25 03:09:51 Re: Replaying archived wal files after a dump restore?
Previous Message Christopher Kings-Lynne 2005-10-25 03:08:56 Re: PostgreSQL 8.1 Beta 4