Concatenation Operator: Is this a bug? - Mailing list pgsql-general

From Matt Friedman
Subject Concatenation Operator: Is this a bug?
Date
Msg-id 001001c0af32$038ef520$74294d18@mattq3h8budilr
Whole thread Raw
Responses Re: Concatenation Operator: Is this a bug?  (Bruno Wolff III <bruno@wolff.to>)
Re: Concatenation Operator: Is this a bug?  (Peter Eisentraut <peter_e@gmx.net>)
List 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 by date:

Previous
From: Jeff Davis
Date:
Subject: simple question: building psql
Next
From: Bruno Wolff III
Date:
Subject: Re: Concatenation Operator: Is this a bug?