Re: PG SQL and LIKE clause

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: PG SQL and LIKE clause
Дата
Msg-id 20804.1568384675@sss.pgh.pa.us
обсуждение исходный текст
Ответ на PG SQL and LIKE clause  (Matthias Apitz <guru@unixarea.de>)
Список pgsql-general
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



В списке pgsql-general по дате отправления:

Предыдущее
От: Ray O'Donnell
Дата:
Сообщение: Re: backing up the data from a single table?
Следующее
От: Ron
Дата:
Сообщение: Re: backing up the data from a single table?