> On Jun 14, 2023, at 4:31 PM, M Sarwar <sarwarmd02@outlook.com> wrote:
>
> I expect this to behave the same way whether it comes from CHAR or VARCHAR.
Why would you expect that??? CHAR explicitly means that:
1) shorter strings will be space-padded to the given length
2) if a string is presented with spaces making it longer, it will be truncated
Putting it all together, it implies:
3) trailing spaces are semantically meaningless
Anyway, the closest I could to finding a reference on comparison behavior for this case states: "The ANSI standard
requirespadding for the character strings used in comparisons so that their lengths match before comparing them."
And there you go, you used CHAR(10), so all values in the table are space-padded to length 10, so for comparison *any*
valuewill be space-padded to 10.