concatenation with a null column (using ||) nulls the result?

From: Neil Harkins <nharkins(at)well(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: concatenation with a null column (using ||) nulls the result?
Date: 2006-04-10 21:36:47
Message-ID: Pine.SOL.4.10.10604101430250.2779-100000@well.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


inventory=> SELECT cabinets_name, cabinets_description
FROM cabinets WHERE cabinets_datacenters = 2;
cabinets_name | cabinets_description
---------------+----------------------
548-4th-Cab2 |
548-4th-RR1 |
548-4th-RR2 |
548-4th-Cab1 |
(4 rows)

inventory=> SELECT cabinets_name || ' - ' || cabinets_description AS concat
FROM cabinets WHERE cabinets_datacenters = 2;
concat
-----------------

548-4th-Cab1 -
(4 rows)

Note: The cabinets_description for the "548-4th-Cab1" row is " ",
not NULL, hence it being displayed. Is this standard SQL behavior?

Client is from rpm: postgresql-8.0.7-1.FC4.1
Server is from rpm: postgresql-server-8.0.7-1.FC4.1

-neil

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2006-04-10 21:47:26 Re: concatenation with a null column (using ||) nulls the result?
Previous Message Markus Schaber 2006-04-10 16:31:12 Re: have you feel anything when you read this ?