Re: [GENERAL] 'a' == 'a ' - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [GENERAL] 'a' == 'a '
Date
Msg-id 13595.1129839083@sss.pgh.pa.us
Whole thread Raw
In response to Re: [GENERAL] 'a' == 'a '  (Chris Travers <chris@travelamericas.com>)
Responses Re: [GENERAL] 'a' == 'a '  (Richard_D_Levine@raytheon.com)
List pgsql-hackers
Chris Travers <chris@travelamericas.com> writes:
> IIrc, varchar and bpchar are stored in a similar way, but are presented
> differently when retrieved.  I.e. storage is separate from presentation
> in this case.  I.e. the padding in bpchar occurs when it is presented
> and stripped when it is stored.

This is not so, although I've occasionally wondered whether we shouldn't
try to make it so.  Certainly we don't rely on char(N) to be physically
fixed-width (and can't, at least not with variable-width character
encodings) so there can be no performance advantage to actually storing
the insignificant spaces.  The hard part would be in figuring out how
the output routine could know how many spaces to add back.

            regards, tom lane

pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: Seeing context switch storm with 10/13 snapshot of
Next
From: Andrew Dunstan
Date:
Subject: Re: 8.04 and RedHat/CentOS init script issue and sleep