Concatenation Operator: Is this a bug?

Поиск
Список
Период
Сортировка
От Matt Friedman
Тема Concatenation Operator: Is this a bug?
Дата
Msg-id 001001c0af32$038ef520$74294d18@mattq3h8budilr
обсуждение исходный текст
Ответы Re: Concatenation Operator: Is this a bug?
Re: Concatenation Operator: Is this a bug?
Список pgsql-general
pgsql 7.0.3 linux

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.

I would expect for instance, if "title", "author", and "description" have
values but the others are null that I would get a row with just the text
from "title", "author", and "description" (concatenated) to be returned in
the row with the other values simply missing (since they are null). Instead
the whole row is returned but has no text, that is, it's blank.

SELECT
  title || ' ' || author || ' ' || description || ' ' || excerpt_title || '
' || excerpt_intro || ' ' || excerpt AS text
FROM
  books;

Is this an issue with null being considered a "non" value? Would a cast on
the columns help? Perhaps there is an ifnull return someting function?

Thanks,
Matt.


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

Предыдущее
От: Jeff Davis
Дата:
Сообщение: simple question: building psql
Следующее
От: Bruno Wolff III
Дата:
Сообщение: Re: Concatenation Operator: Is this a bug?