PG Bug reporting form <noreply@postgresql.org> writes:
> PostgreSQL version: 11.9
> When testing consistency between index (only) scan and seqscan, I found that
> the results returned by index only scan using gist index of bpchar and
> seqscan have difference.
This was fixed last year, in 11.15 (and releases of same date in other
branches). Per those release notes:
Fix results of index-only scans on contrib/btree_gist indexes on char(N)
columns (Tom Lane)
Index-only scans returned column values with trailing spaces removed,
which is not the expected behavior. That happened because that's how
the data was stored in the index. This fix changes the code to store
char(N) values with the expected amount of space padding. The behavior
of such an index will not change immediately unless you REINDEX it;
otherwise space-stripped values will be gradually replaced over time
during updates. Queries that do not use index-only scan plans will be
unaffected in any case.
regards, tom lane