Re: PG SQL and LIKE clause

Поиск
Список
Период
Сортировка
От Ron
Тема Re: PG SQL and LIKE clause
Дата
Msg-id ed0438be-ee6c-7e25-e39d-ae56982dc1de@gmail.com
обсуждение исходный текст
Ответ на PG SQL and LIKE clause  (Matthias Apitz <guru@unixarea.de>)
Ответы Re: PG SQL and LIKE clause
Список pgsql-general
On 9/13/19 12:28 AM, Matthias Apitz wrote:
> Hello,
>
> We're porting a huge Library Management System, written using all kind
> of languages one can think of (C, C++, ESQL/C, Perl, Java, ...) on Linux
> from the DBS Sybase to PG, millions of lines of code, which works also
> with DBS Oracle and in the past with INFORMIX-SE and -ONLINE.
>
> 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 '.

Did you forget the "%"?  Because the SQL standard which PostgreSQL follows is:

SELECT ... FROM ... WHERE name LIKE '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.

SQL Server derives from Sybase, and it would also fail on this statement.

> Any hints to address this problem? Or is there any compile time option
> for the PG server to address this?
>
> Thanks
>
>     matthias

-- 
Angular momentum makes the world go 'round.



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

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: PG SQL and LIKE clause
Следующее
От: Matthias Apitz
Дата:
Сообщение: Re: PG SQL and LIKE clause