Concatenation Operator: Is this a bug?

From: "Matt Friedman" <matt(at)daart(dot)ca>
To: "PgSql General List" <pgsql-general(at)postgresql(dot)org>
Subject: Concatenation Operator: Is this a bug?
Date: 2001-03-17 22:31:30
Message-ID: 001001c0af32$038ef520$74294d18@mattq3h8budilr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruno Wolff III 2001-03-17 23:26:44 Re: Concatenation Operator: Is this a bug?
Previous Message Jeff Davis 2001-03-17 22:17:19 simple question: building psql