Re: [BUGS] BUG #14693: create materialized view forces btrim

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: [BUGS] BUG #14693: create materialized view forces btrim
Дата
Msg-id CAKFQuwbXXYVKnsr2G+y-WxJcWNnBzCn==7FoCVjCpn4PReZ9bQ@mail.gmail.com
обсуждение исходный текст
Ответ на [BUGS] BUG #14693: create materialized view forces btrim  (isb0459@gmail.com)
Ответы Re: [BUGS] BUG #14693: create materialized view forces btrim  (Ian Boardman <isb0459@gmail.com>)
Список pgsql-bugs
On Tue, Jun 6, 2017 at 1:25 PM, <isb0459@gmail.com> wrote:
I am trying to create a materialized view. I have a working SQL query that
uses this expression: coalesce(trim(foo), bar). When I use that in the
definition for create materialized view, Postgres force replaces the trim()
call into a btrim() and breaks the query result. In my specific case, all
the values become empty instead of yielding either the trimmed "foo" or the
"bar" fields if trimmed "foo" is empty. Is there a way to make Postgres use
the function trim as I require?

​COALESCE returns the first non-null value.  The empty string is non-null and so it will be returned.

try:

COALESCE(NULLIF(trim(foo), ''), bar);

David J.

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [BUGS] BUG #14693: create materialized view forces btrim
Следующее
От: Ian Boardman
Дата:
Сообщение: Re: [BUGS] BUG #14693: create materialized view forces btrim