Skip site navigation (1) Skip section navigation (2)

Concatenation containing a "null" term

From: "Pierre Thibaudeau" <pierdeux(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Concatenation containing a "null" term
Date: 2006-05-28 21:17:12
Message-ID: 74b035bb0605281417x5fcfc69t6a1def25c193a02d@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-novice
(I am certain I once saw the answer to the following question, but I can't
for the life of me find out where!)

I create a View as

SELECT (firstname || ' ' || lastname)::character(50) AS fullname
FROM name_table;

firstname and lastname are text columns, and firstname may be null.

Unfortunately, it seems that whenever firstname is null, the resulting
fullname is null also.  Is there a way of having the null-strings terms of
the concatenation operator be considered as empty strings instead?

Thanks for the help!

Responses

pgsql-novice by date

Next:From: Michael FuhrDate: 2006-05-28 21:33:37
Subject: Re: Concatenation containing a "null" term
Previous:From: Donald BradyDate: 2006-05-28 06:02:02
Subject: trigger help

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group