pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Don Drake <dondrake@gmail.com>
To: pgsql-sql@postgresql.org
Subject: NULLS and string concatenation
Date: Fri, 19 Nov 2004 11:12:38 -0600
Message-ID: <6c21003b0411190912630d4afe@mail.gmail.com> (raw)

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?

I was able to work around the problem by using COALESCE (and casting
variables since it wants the same data types passed to it).

-Don

-- 
Donald Drake
President
Drake Consulting
http://www.drakeconsult.com/
312-560-1574



view thread (12+ messages)  latest in thread

Message-ID: <6c21003b0411190912630d4afe@mail.gmail.com>
Permalink:  ../6c21003b0411190912630d4afe@mail.gmail.com/
Also on:    postgresql.org/message-id/6c21003b0411190912630d4afe@mail.gmail.com

 · 

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: dondrake@gmail.com
  Subject: Re: NULLS and string concatenation
  In-Reply-To: <6c21003b0411190912630d4afe@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