=?iso-8859-1?Q?Thorbj=F6rn_Eriksson?= <thorbjorn(dot)eriksson(at)ec(dot)se> writes:
> I've encountered a strange behavior in postgres 7.2.1 regarding how psql
> handles strings ending with space characters.
Perhaps you are running in a non-C locale? A lot of locales have
sorting rules that are pretty weird about whitespace.
> The reason that we don't use 'LIKE 201901 %' is that it don't use
> the index
This suggests strongly that you are in a non-C locale. Your external
software seems to be emulating the standard LIKE-to-index optimization;
which as you are now discovering, does not work with non-C sorting
rules (so the system doesn't try to apply it).
regards, tom lane