pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruno Wolff III <bruno@wolff.to>
To: Don Drake <dondrake@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: NULLS and string concatenation
Date: Fri, 19 Nov 2004 11:45:43 -0600
Message-ID: <20041119174543.GA26505@wolff.to> (raw)
In-Reply-To: <6c21003b0411190912630d4afe@mail.gmail.com>
References: <6c21003b0411190912630d4afe@mail.gmail.com>

On Fri, Nov 19, 2004 at 11:12:38 -0600,
  Don Drake <dondrake@gmail.com> wrote:
> I have a function that uses an execute statement to insert data into a
> table, I do in my implementation of table partitioning.
> 
> Anyway, I ran into trouble when NULL values were being passed in
> (fields are nullable) and my insert statement turned into a big NULL.
> 
> Here's an equivalent statement that caused trouble:
> 
> 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.
> 
> I was able to work around the problem by using COALESCE (and casting
> variables since it wants the same data types passed to it).

This is what you should do.

> 
> -Don
> 
> -- 
> Donald Drake
> President
> Drake Consulting
> http://www.drakeconsult.com/
> 312-560-1574
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
>       subscribe-nomail command to majordomo@postgresql.org so that your
>       message can get through to the mailing list cleanly



view thread (12+ messages)  latest in thread

Message-ID: <20041119174543.GA26505@wolff.to>
Permalink:  ../20041119174543.GA26505@wolff.to/
Also on:    postgresql.org/message-id/20041119174543.GA26505@wolff.to

 · 

reply

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: bruno@wolff.to, dondrake@gmail.com
  Subject: Re: NULLS and string concatenation
  In-Reply-To: <20041119174543.GA26505@wolff.to>

* 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