Re: char columns, space padding, and the "like" operator
В списке pgsql-interfaces по дате отправления:
| От | Tom Lane |
|---|---|
| Тема | Re: char columns, space padding, and the "like" operator |
| Дата | |
| Msg-id | 8609.1233610735@sss.pgh.pa.us обсуждение |
| Ответ на | char columns, space padding, and the "like" operator ("Haszlakiewicz, Eric" <EHASZLA@transunion.com>) |
| Ответы |
Re: char columns, space padding, and the "like" operator
|
| Список | pgsql-interfaces |
"Haszlakiewicz, Eric" <EHASZLA@transunion.com> 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
В списке pgsql-interfaces по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера