On Sunday, January 20, 2008 Fowler, Jeff wrote: 

> briefly, ANSI SQL-92 specifies that when comparing two character
> fields, trailing spaces should be ignored.

From SQL-92 (draft July 1992) section 4.6

> When values of unequal length are compared, if the collating
> sequence for the comparison has the NO PAD attribute and the shorter
> value is equal to a prefix of the longer value, then the shorter
> value is considered less than the longer value. If the collating
> sequence for the comparison has the PAD SPACE attribute, for the
> purposes of the comparison, the shorter value is effectively
> extended to the length of the longer by concatenation of <space>s on
> the right.

section 8.2 also says

> 3) The comparison of two character strings is determined as fol-
>    lows:
> 
>    a) If the length in characters of X is not equal to the length
>      in characters of Y, then the shorter string is effectively
>      replaced, for the purposes of comparison, with a copy of
>      itself that has been extended to the length of the longer
>      string by concatenation on the right of one or more pad char-
>      acters, where the pad character is chosen based on CS. If
>      CS has the NO PAD attribute, then the pad character is an
>      implementation-dependent character different from any char-
>      acter in the character set of X and Y that collates less
>      than any string under CS. Otherwise, the pad character is a
>      <space>.

So, using this terminology, the SQLite default collating sequence has
the NO PAD attribute, and the pad character is NUL.

Jeff, can you solve your problem with a custom collating sequence?

e

-- 
Doug Currie
Londonderry, NH, USA


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to