Re: bug or feature, || -operator and NULLs

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Andreas Joseph Krogh <andreak(at)officenet(dot)no>
Cc: pgsql-hackers(at)postgresql(dot)org, Mario Weilguni <mweilguni(at)sime(dot)com>
Subject: Re: bug or feature, || -operator and NULLs
Date: 2006-10-18 13:11:32
Message-ID: 20061018131132.GP31297@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andreas Joseph Krogh wrote:

> Why do these discussions always end in academic arguments over whats more
> logical then not? From a *user's* point of view I really would like it to
> treat the NULL operand of || as '', and obviously many other (at least
> Oracle) users tend to agree with me on that.

So coalesce the column to the empty string if that's what you want:

select coalesce(NULL, '') || 'fisk'

will get you 'fisk'.

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Lukas Kahwe Smith 2006-10-18 13:11:47 Re: bug or feature, || -operator and NULLs
Previous Message Andreas Joseph Krogh 2006-10-18 13:07:42 Re: bug or feature, || -operator and NULLs