> I guess the strangest part was that both a.foo = 'S' and b.foo = 'S' but
> not a.foo=b.foo; (a.foo is varchar(5) , b.foo is char(5) )
>
> I guess that tha 'S' that b.foo gets compared to is converted to 'S '
> before comparison but when comparing varchar(5) and char(5) they are
> both compared by converting them to varchar which keeps the trailing
> spaces from char(5).
Yes, I think this is inconvenient/unintuitive. If it is doable according to
standards, this should imho be fixed.
> If the conversion where varchar(5) --> char(5) then
> they would compare equal.
I am not sure, since, if the varchar stored 'S ' then the comparison to a char 'S'
should probably still fail, since those spaces in the varchar are significant.
Informix compares them equal, so I guess argumentation can be made in that direction
too (that currently evades my understanding of intuitive reasoning :-).
Andreas