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 911333A4C16 for ; Fri, 19 Nov 2004 18:40:07 +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 11948-03 for ; Fri, 19 Nov 2004 18:40:03 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.193]) by svr1.postgresql.org (Postfix) with ESMTP id C8DD23A4C13 for ; Fri, 19 Nov 2004 18:40:02 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 68so54693wri for ; Fri, 19 Nov 2004 10:40:02 -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:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=LIHL3aBBrJIOu2CQRlPGPbqAzDSpQoB4+Tu6aqlNhQQJN0WYWgnnohWEw9rMHjQDrSNLz+i3CiFPCcnWw0PDF3PSCzVHuijYm342SZu+IL9+p3qLvz0UncIou9itxDDuSPKs4tGc6kfCx/VKcRnIRSO8vGlS/7wj6/5eKl3koew= Received: by 10.54.38.45 with SMTP id l45mr186476wrl; Fri, 19 Nov 2004 10:40:02 -0800 (PST) Received: by 10.54.52.30 with HTTP; Fri, 19 Nov 2004 10:40:02 -0800 (PST) Message-ID: <6c21003b041119104039c88faf@mail.gmail.com> Date: Fri, 19 Nov 2004 12:40:02 -0600 From: Don Drake Reply-To: Don Drake To: Richard Huxton Subject: Re: NULLS and string concatenation Cc: pgsql-sql@postgresql.org In-Reply-To: <419E31F2.4060104@archonet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <6c21003b0411190912630d4afe@mail.gmail.com> <419E31F2.4060104@archonet.com> 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/204 X-Sequence-Number: 19523 On Fri, 19 Nov 2004 17:48:34 +0000, Richard Huxton 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