Thread: Re: [HACKERS] lower() not working correctly...?

Re: [HACKERS] lower() not working correctly...?

From
Ragnar
Date:
On fös, 2006-09-15 at 09:52 +0200, Andreas Joseph Krogh wrote:
> I have the following query:
> 
> select lower(firstname) || ' ' || lower(lastname) from person
> 
> firstname and lastname are VARCHAR
> 
> lower() returns NULL when firstname OR lastname is NULL, is this correct?

In fact, your problem has nothing to do with lower().

You probably did not expect the || operator
to return NULL when any of the operands is NULL

as seen in 
select firstname || ' ' || lastname from person

so , as someone else has already mentioned,
you should use coalesce.

gnari