Re: [HACKERS] 'a' == 'a '

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Chris Travers <chris(at)travelamericas(dot)com>
Cc: Dann Corbit <DCorbit(at)connx(dot)com>, Greg Stark <gsstark(at)mit(dot)edu>, josh(at)agliodbs(dot)com, pgsql-hackers(at)postgresql(dot)org, Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>, Terry Fielder <terry(at)ashtonwoodshomes(dot)com>, Tino Wildenhain <tino(at)wildenhain(dot)de>, "Marc G(dot) Fournier" <scrappy(at)postgresql(dot)org>, Richard_D_Levine(at)raytheon(dot)com, pgsql-general(at)postgresql(dot)org
Subject: Re: [HACKERS] 'a' == 'a '
Date: 2005-10-20 20:11:23
Message-ID: 13595.1129839083@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Chris Travers <chris(at)travelamericas(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Chris Travers 2005-10-20 20:17:56 Re: Oracle and PostgreSQL...
Previous Message Martijn van Oosterhout 2005-10-20 20:01:27 Re: PSQL suggested enhancement

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2005-10-20 20:19:18 Re: Seeing context switch storm with 10/13 snapshot of
Previous Message Dann Corbit 2005-10-20 19:56:16 Re: [HACKERS] 'a' == 'a '