Substring auto trim

Поиск
Список
Период
Сортировка
От Charles O'Farrell
Тема Substring auto trim
Дата
Msg-id 65d71e1c1001130102j5f46299cm87477efcfd0c5a51@mail.gmail.com
обсуждение исходный текст
Ответы Re: Substring auto trim  (Pavel Stehule <pavel.stehule@gmail.com>)
Re: Substring auto trim  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
Hi guys,

I'm not sure whether this a really dumb question, but I'm curious as to what
might be the problem.

We have a column 'foo' which is of type character (not varying).

select substr(foo, 1, 10) from bar

The result of this query are values whose trailing spaces have been trimmed
automatically. This causes incorrect results when comparing to a value that
may contain trailing spaces.

select * from bar where substr(foo, 1, 4) = 'AB  '

I should mention that we normally run Oracle and DB2 (and have done for many
years), but I have been pushing for Postgres as an alternative.
Fortunately this is all handled through Hibernate, and so for now I have
wrapped the substr command in rpad which seems to do the trick.

Any light you can shed on this issue would be much appreciated.

Cheers,

Charles O'Farrell

PostgreSQL 8.4.2 on i486-pc-linux-gnu, compiled by GCC gcc-4.4.real (Ubuntu
4.4.1-4ubuntu8) 4.4.1, 32-bit

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

Предыдущее
От: Kris Jurka
Дата:
Сообщение: Re: BUG #5269: postgres backend terminates with SIGSEGV
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: Substring auto trim