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 86709D1D2CC for ; Thu, 1 Apr 2004 21:37:15 +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 16468-06 for ; Thu, 1 Apr 2004 17:37:13 -0400 (AST) Received: from joeconway.com (66-146-172-82.skyriver.net [66.146.172.82]) by svr1.postgresql.org (Postfix) with ESMTP id 59B19D1EA5A for ; Thu, 1 Apr 2004 17:37:11 -0400 (AST) Received: from [206.19.64.3] (account jconway HELO joeconway.com) by joeconway.com (CommuniGate Pro SMTP 4.1.8) with ESMTP-TLS id 1218356; Thu, 01 Apr 2004 13:31:51 -0800 Message-ID: <406C8B6D.2040603@joeconway.com> Date: Thu, 01 Apr 2004 13:36:45 -0800 From: Joe Conway User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6) Gecko/20040113 X-Accept-Language: en-us, en MIME-Version: 1.0 To: josh@agliodbs.com Cc: pgsql-sql@postgresql.org Subject: Re: Array_append does not work with Array variables in PL/pgSQL? References: <200404011320.37766.josh@agliodbs.com> In-Reply-To: <200404011320.37766.josh@agliodbs.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200404/3 X-Sequence-Number: 17378 Josh Berkus wrote: > v_vals TEXT[]; > n_vals TEXT[]; try: v_vals TEXT[] := ''{}''; n_vals TEXT[] := ''{}''; 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: regression=# select (NULL || 'abc') is null; ?column? ---------- t (1 row) Joe