From: Nick Fankhauser <nickf@ontko.com>
To: David BOURIAUD <david.bouriaud@ac-rouen.fr>
To: pgsql-sql@postgresql.org
Subject: Re: Is this a feature ?
Date: Tue, 4 Jun 2002 09:38:53 -0500
Message-ID: <NEBBLAAHGLEEPCGOBHDGIEBLFBAA.nickf@ontko.com> (raw)
In-Reply-To: <200206041018.24328.david.bouriaud@ac-rouen.fr>
> if one of the fields (civ, name or forname) is null, identity is
> null... That doesn't seems right, since it means that 1+2+0 = 0 !!!!
The crux of the matter is that zero and null aren't the same thing. Null
means in essence "We don't know", so this equation is better writtin as:
1+2+"don't know" = "don't know"
> is there a
> way to work
> this around ?
It *is* often true that when concatenating strings, we want to tell SQL "if
this value is null, treat it like an empty string". This is how you would do
it:
coalesce( civ,'')||coalesce(name,'')||coalesce(forname,'')
Regards,
-Nick
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: nickf@ontko.com, david.bouriaud@ac-rouen.fr
Subject: Re: Is this a feature ?
In-Reply-To: <NEBBLAAHGLEEPCGOBHDGIEBLFBAA.nickf@ontko.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox