Re: char columns, space padding, and the "like" operator
Tom Lane <[email protected]> Mon, 02 Feb 2009 16:38:55 -0500
| Newsgroups | gmane.comp.db.postgresql.interfaces |
|---|---|
| Message-ID | <[email protected]> |
"Haszlakiewicz, Eric" <[email protected]> writes: > Once I realized that the value in the table actually got extended to > 'SOMEVALUE ', things started making sense, since the equivalent quick > select is actually: > select 'SOMEVALUE ' like 'SOME% %'; > Unfortunately, my app has a whole bunch of places where it uses > constructs like this against char columns. Other databases (such as > Informix), automatically strip spaces off char column so queries like > the above behave in a more intuitive fashion. Cast the char(n) column to text or varchar, and it should work more like you're expecting. regards, tom lane -- Sent via pgsql-interfaces mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-interfaces