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

Re: NULLS and string concatenation

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Don Drake <dondrake(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: NULLS and string concatenation
Date: 2004-11-19 17:45:43
Message-ID: 20041119174543.GA26505@wolff.to (view raw or flat)
Thread:
Lists: pgsql-sql
On Fri, Nov 19, 2004 at 11:12:38 -0600,
  Don Drake <dondrake(at)gmail(dot)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(at)postgresql(dot)org so that your
>       message can get through to the mailing list cleanly

In response to

Responses

pgsql-sql by date

Next:From: Richard HuxtonDate: 2004-11-19 17:48:34
Subject: Re: NULLS and string concatenation
Previous:From: Don DrakeDate: 2004-11-19 17:12:38
Subject: NULLS and string concatenation

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