Re: [PATCH] backend: compare word-at-a-time in bcTruelen - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [PATCH] backend: compare word-at-a-time in bcTruelen
Date
Msg-id 6829.1245333597@sss.pgh.pa.us
Whole thread Raw
In response to Re: [PATCH] backend: compare word-at-a-time in bcTruelen  (Simon Riggs <simon@2ndQuadrant.com>)
Responses Re: [PATCH] backend: compare word-at-a-time in bcTruelen  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Re: [PATCH] backend: compare word-at-a-time in bcTruelen  (Simon Riggs <simon@2ndQuadrant.com>)
List pgsql-hackers
Simon Riggs <simon@2ndQuadrant.com> writes:
> Why is bcTruelen being called so many *more* times?

I think you have misunderstood the context.  The char(n) code is defined
to store trailing blanks (up to n) but to disregard the trailing blanks
during comparisons.  bcTrueLen is invoked during comparisons (not during
storage) to figure out what the "valid" string length is for comparing.

varchar considers any trailing blanks to be real, comparable data,
so it simply hasn't got any equivalent code.

It would be way nicer if we could strip trailing blanks on storage,
and then figure a way to either reconstitute them on output (problem
here is the output function doesn't have access to typmod) or
language-lawyer our way to deciding we don't have to.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Florian Weimer
Date:
Subject: Re: [PATCH] backend: compare word-at-a-time in bcTruelen
Next
From: "Kevin Grittner"
Date:
Subject: Re: [PATCH] backend: compare word-at-a-time in bcTruelen