X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 96EC5D1DB9F for ; Thu, 1 Apr 2004 21:49:04 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 17127-10 for ; Thu, 1 Apr 2004 17:48:58 -0400 (AST) Received: from davinci.ethosmedia.com (server228.ethosmedia.com [209.128.84.228]) by svr1.postgresql.org (Postfix) with ESMTP id 7572ED1EBB9 for ; Thu, 1 Apr 2004 17:48:55 -0400 (AST) Received: from [63.195.55.98] (HELO 192.168.1.29) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 4749317; Thu, 01 Apr 2004 13:50:16 -0800 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: Joe Conway Subject: Re: Array_append does not work with Array variables in PL/pgSQL? Date: Thu, 1 Apr 2004 13:48:26 -0800 User-Agent: KMail/1.5.4 Cc: pgsql-sql@postgresql.org References: <200404011320.37766.josh@agliodbs.com> <406C8B6D.2040603@joeconway.com> In-Reply-To: <406C8B6D.2040603@joeconway.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200404011348.26646.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200404/4 X-Sequence-Number: 17379 Joe, > You have to initialize the array to something non-null, even if that be > an empty array (note that there is a difference). When trying to append > an element to a NULL valued array, you wind up with a NULL result. It is > similar to: Aha! I knew that I was missing something fundamental. BTW, did you get my e-mail to Hackers about ARRAY[] IS NULL? -- -Josh Berkus Aglio Database Solutions San Francisco