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

Re: Combining text fields

From: Nabil Sayegh <postgresql(at)e-trolley(dot)de>
To: Doug Silver <dsilver(at)urchin(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Combining text fields
Date: 2003-10-18 13:27:23
Message-ID: 3F913FBB.50203@e-trolley.de (view raw or flat)
Thread:
Lists: pgsql-novice
Doug Silver wrote:
> I just want to confirm that this is the correct behavior for the return value 
> when combining text fields together.  If one of the fields is NULL, then the 
> return value of field1+field2 also becomes NULL.  If this is correct, is the 
> proper way to get around this to use a default value of '' for such fields?

This is correct behaviour (every comparison with NULL returns NULL)

http://developer.postgresql.org/docs/postgres/functions-comparison.html
-------------------------------8<----------------------------------------
Some applications may (incorrectly) require that expression = NULL 
returns true if expression evaluates to the null value. To support these 
applications, the run-time option transform_null_equals can be turned on 
(e.g., SET transform_null_equals TO ON;). PostgreSQL will then convert x 
= NULL clauses to x IS NULL. This was the default behavior in releases 
6.5 through 7.1.
-------------------------------8<----------------------------------------

HTH
-- 
  e-Trolley Sayegh & John, Nabil Sayegh
  Tel.: 0700 etrolley /// 0700 38765539
  Fax.: +49 69 8299381-8
  PGP : http://www.e-trolley.de


In response to

pgsql-novice by date

Next:From: Paul LinehanDate: 2003-10-18 23:12:17
Subject: Installing on Red Hat 9?
Previous:From: Josh BerkusDate: 2003-10-18 02:55:55
Subject: Re: scaleable design for multiple value tuple

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