dynamobi/dynamobi — Issue #507: [FNL-1] varchar comparison is incorrect
Author: dynamobi-build
Created: 2011-12-30 03:30:34+00:00
State: open
Labels: Calc, FNL

[reporter="jvs", created="Sun, 4 Dec 2005 02:52:23 -0500 (GMT-05:00)"]
See bottom of email transcript below regarding SqlStrCmp_Var.

From John Kalucki Fri Dec 2 19:42:54 2005

--------------ms000005040008070100000104

Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Content-Transfer-Encoding: 7bit

I'm wondering (out loud) if, in the absence of a PAD / NO PAD switch, if

NO PAD makes more sense for Varchar. It allows full 8-bit comparisons. I

haven't looked to see if characters less than space are legal in strings

yet, as that's not always easy to find.

I've a fix for Varchar, but I have to work over Char next.

I think I'm going to have to continue with this on Monday.

John V. Sichi wrote:

> OK. If you can use it, the code in VarCharType::compareValues

> (StandardTypeDescriptor.cpp) has the correct PAD SPACE comparison

> semantics (SQL:2003 Part 2 Section 4.2.2).

>

> I'm still working on getting the Eigenbase JIRA set up so we can start

> sharing info on this stuff (this one was caught by one of our QA

> engineers).

>

> JVS

>

> On Fri, 2005-12-02 at 17:16 -0800, John Kalucki wrote:

>

>> The implementation code is clearly wrong by any reading of SQL99, or

>> anything, really. I was most perplexed as to how my unit test didn't

>> catch this boneheadedness. I've fixed one part of the unit test and it

>> works properly now -- and flags lots of problems.

>>

>>

>> John V. Sichi wrote:

>>

>>> I'm staring at SqlStrCmp_Var, and I'm asking myself, has it always been

>>> this way? It says 'AAA' < 'BB' is false because 'AAA' is longer? That

>>> sure ain't supposed to be the case.

>>>

>>> It also doesn't handle the trimchar the way SqlStrCmp_Fixed does. (We

>>> don't currently support PAD vs. NO PAD, so we're probably supposed to

>>> use PAD semantics by default, since that's the old standard.)

>>>

>>> JVS

>>>

>>>

>>>