From: Don Drake <dondrake@gmail.com>
To: Richard Huxton <dev@archonet.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: NULLS and string concatenation
Date: Fri, 19 Nov 2004 12:40:02 -0600
Message-ID: <6c21003b041119104039c88faf@mail.gmail.com> (raw)
In-Reply-To: <419E31F2.4060104@archonet.com>
References: <6c21003b0411190912630d4afe@mail.gmail.com>
<419E31F2.4060104@archonet.com>
On Fri, 19 Nov 2004 17:48:34 +0000, Richard Huxton <dev@archonet.com> wrote:
> Don Drake wrote:
> > select 'some text, should be null:'|| NULL
> >
> > This returns NULL and no other text. Why is that? I wasn't expecting
> > the "some text.." to disappear altogether.
> >
> > Is this a bug?
>
> No. Null is "unknown" if you append unknown (null) to a piece of text,
> the result is unknown (null) too.
>
> If you're using NULL to mean something other than unknown, you probably
> want to re-examine your reasons why.
>
I'm using NULL to mean no value. Logically, NULL is unknown, I agree.
I'm trying to dynamically create an INSERT statement in a function
that sometimes receives NULL values.
This is still strange to me. In Oracle, the same query would not
replace the *entire* string with a NULL, it treats the NULL as a no
value.
I can't find in the documentation where string concatenation of any
string and NULL is NULL.
-Don
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: dondrake@gmail.com, dev@archonet.com
Subject: Re: NULLS and string concatenation
In-Reply-To: <6c21003b041119104039c88faf@mail.gmail.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