Re: Is this a feature ?

From: "Nick Fankhauser" <nickf(at)ontko(dot)com>
To: "David BOURIAUD" <david(dot)bouriaud(at)ac-rouen(dot)fr>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Is this a feature ?
Date: 2002-06-04 14:38:53
Message-ID: NEBBLAAHGLEEPCGOBHDGIEBLFBAA.nickf@ontko.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> 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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message David BOURIAUD 2002-06-04 14:55:39 Re: Is this a feature ?
Previous Message Jan Wieck 2002-06-04 14:33:42 Re: Is this a feature ?