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

From: "Dann Corbit" <DCorbit(at)connx(dot)com>
To: "John D(dot) Burger" <john(at)mitre(dot)org>
Cc: <pgsql-hackers(at)postgresql(dot)org>, "pgsql-general General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: [HACKERS] 'a' == 'a '
Date: 2005-10-20 19:56:16
Message-ID: D425483C2C5C9F49B5B7A41F8944154757D218@postal.corporate.connx.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Look back in the stack and you will find that I have quoted chapter and
verse (see the attached html file in a previous email that I sent).

This is in relation to the comparison operator.

> -----Original Message-----
> From: John D. Burger [mailto:john(at)mitre(dot)org]
> Sent: Thursday, October 20, 2005 12:53 PM
> To: Dann Corbit
> Cc: <pgsql-hackers(at)postgresql(dot)org>; pgsql-general General
> Subject: Re: [GENERAL] [HACKERS] 'a' == 'a '
>
> [Removed all the non-list addresses]
>
> Dann Corbit wrote:
>
> > Let me make something clear:
> > When we are talking about padding here it is only in the context of
a
> > comparison operator and NOT having anything to do with storage.
> >
> > Given two strings of different in a comparison, most database
systems
> > (by default) will blank pad the shorter string so that they are the
> > same
> > length before performing the comparison.
> >
> > Hence, you will see that 'Danniel' = 'Danniel ' is true in most
cases.
> >
> > Now, this really does not have any connection with storage or
varchar
> > or
> > bpchar or char or text or anything like that.
>
> Is this really true??? My understanding of the spec was that this was
> =exactly= the difference between char(N) and varchar(N) - the former
is
> padded to length N when you store it, or at least the DB has to act as
> if this is the case. Can someone quote the appropriate chapter and
> verse?

Again, the operations that I was talking about literally have nothing to
do with the internal data type of the string, as long as it is
fundamentally a character type. I was referring to what happens when
two strings are involved in a comparison operation. The standard spells
it out very clearly. Whether something is blank padded or not during a
comparison has nothing whatever to do with the type of the string and
everything to do with the collating sequence.

> Thanks.
>
> - John D. Burger
> MITRE

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2005-10-20 20:01:27 Re: PSQL suggested enhancement
Previous Message John D. Burger 2005-10-20 19:53:24 Re: [HACKERS] 'a' == 'a '

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-10-20 20:11:23 Re: [HACKERS] 'a' == 'a '
Previous Message John D. Burger 2005-10-20 19:53:24 Re: [HACKERS] 'a' == 'a '