Re: Concatenation Operator: Is this a bug?

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: Concatenation Operator: Is this a bug?
Дата
Msg-id Pine.LNX.4.30.0103180036250.4749-100000@peter.localdomain
обсуждение исходный текст
Ответ на Concatenation Operator: Is this a bug?  ("Matt Friedman" <matt@daart.ca>)
Список pgsql-general
Matt Friedman writes:

> The following query behaves as I would expect if all the columns mentioned
> have a value in them. If any of the columns are null however, the whole row
> returns but it's blank.

Correct.

> SELECT
>   title || ' ' || author || ' ' || description || ' ' || excerpt_title || '
> ' || excerpt_intro || ' ' || excerpt AS text
> FROM
>   books;
>
> Is this an issue with null being considered a "non" value?

Sort of.  More precisely, it's an issue with following the SQL standard.

> Would a cast on the columns help?

No.

> Perhaps there is an ifnull return someting function?

COALESCE(colname, 'value-if-null')

--
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/


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

Предыдущее
От: Bruno Wolff III
Дата:
Сообщение: Re: Concatenation Operator: Is this a bug?
Следующее
От: "Moishe Groger"
Дата:
Сообщение: Cannot start postmaster