On Wed, Apr 24, 2013 at 8:47 AM, uwekeim <[email protected]> wrote: > > > > > in other words, before comparison, the shorter string is padded with > > "pad-character" (usually a space) to the length of the longer string. > > > > So, it's not a bug, but a SQL-standards feature. > > > > oops - okay, that's the explanation, although this behavior doesn't make > sense to me... >
You're looking a a single case of various numbers of space characters in a column, including none.. Consider this case instead. Suppose through a failure of database design, I have fields in two tables, both fields called first_name. One is declared as "CHAR[15]" and the other as VARCHAR[15]. Someone stores 'Ann' in each field, then tries to join the two tables on first_name. As you know, CHAR fields are blank filled to their full size, so the values are 'Ann ' and 'Ann'. If trailing blanks are significant, the two values don't match. I suppose the SQL committee could have said something like "trailing blanks are ignored iff a value includes a non-blank" and satisfied both goals - yours and mine - but I don't really think that's an improvement. Good luck, Ann [Non-text portions of this message have been removed]
