Tom Lane wrote:
> This probably has more to do with what these systems think the
> data type of an undecorated literal is, than with whether they do
> trailing-space-insensitive comparison all the time.
I suspect so. Keep in mind that PostgreSQL does not comply with the
standard in this regard, but this has been discussed before and it
is a concious decision to deviate. See section section 5.3
<literal> syntax 17:
| The declared type of a <character string literal> is fixed-length
| character string.
... so according to the standard 'a' is CHAR(1) and 'a ' is
CHAR(4), and they should compare as equal. To make literals for
user-defined types more convenient to write, PostgreSQL treats
those literals as type UNKOWN until forced to resolve them to a
type, and in the absence of any other clues uses text instead of
char(n). The reason for that is that the community finds the
semantics of char(n) strange and generally encourages use of text
or varchar(n) for character-based types.
I'm not sure that this is as clearly and prominently documented as
it should be.
-Kevin