M Sarwar <sarwarmd02@outlook.com> writes:
> I expect this to behave the same way whether it comes from CHAR or VARCHAR.
You expect incorrectly. CHAR comparison is insensitive to trailing
spaces:
https://www.postgresql.org/docs/current/datatype-character.html
regards, tom lane