Matthias Apitz <guru@unixarea.de> writes:
> We got to know that in CHAR columns with trailing blanks a
> SELECT ... FROM ... WHERE name LIKE 'Ali'
> does not match in 'name' having 'Ali '.
> I glanced through our code with grep pipelines and found some hundred
> places which would be affected by this problem. I'm not interested in a
> religious discussion if or if not this behaviour of PG is correcter or
> better than in Sybase. It's just different to Sybase.
> Any hints to address this problem?
Don't use char(n) for anything more complicated than cases like
it-must-be-a-2-character-state-abbreviation. You can use varchar(n)
if you must have an upper limit on the field length. Or text.
regards, tom lane