X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 07F3A3A4B81 for ; Fri, 19 Nov 2004 17:12:48 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 85132-03 for ; Fri, 19 Nov 2004 17:12:41 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.194]) by svr1.postgresql.org (Postfix) with ESMTP id B441C3A4B1E for ; Fri, 19 Nov 2004 17:12:40 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 71so52856wra for ; Fri, 19 Nov 2004 09:12:40 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding; b=V+NLF8fbmnBoMsHQn9OvGISoNoLmpcuuJ78PBwe+6HuRqtKjUniXh/gIt7/4cyv9AAK07d8nhKPg43Dl+he53ba45ukaF9RsqH6m7VfCFAtMNcuyjs1UGnJ/dnNL8FkNu8+7iVMYkgjKACq+aHW9xnnPo0nlZaev0uphhPMA52c= Received: by 10.54.41.50 with SMTP id o50mr193624wro; Fri, 19 Nov 2004 09:12:39 -0800 (PST) Received: by 10.54.52.30 with HTTP; Fri, 19 Nov 2004 09:12:38 -0800 (PST) Message-ID: <6c21003b0411190912630d4afe@mail.gmail.com> Date: Fri, 19 Nov 2004 11:12:38 -0600 From: Don Drake Reply-To: Don Drake To: pgsql-sql@postgresql.org Subject: NULLS and string concatenation Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200411/200 X-Sequence-Number: 19519 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