Re: Concatenation Operator: Is this a bug?

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Matt Friedman <matt(at)sprynewmedia(dot)com>
Cc: PgSql General List <pgsql-general(at)postgresql(dot)org>
Subject: Re: Concatenation Operator: Is this a bug?
Date: 2001-03-17 23:38:16
Message-ID: Pine.LNX.4.30.0103180036250.4749-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gmx(dot)net http://yi.org/peter-e/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bill Barnes 2001-03-18 04:42:27 Re: Re: URL for gmake
Previous Message Moishe Groger 2001-03-17 23:32:53 Cannot start postmaster