X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id ECED7D1B52B for ; Thu, 11 Sep 2003 21:09:08 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 14557-04 for ; Thu, 11 Sep 2003 18:09:00 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id D983CD1B55D for ; Thu, 11 Sep 2003 18:08:57 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h8BL8xAn001481; Thu, 11 Sep 2003 17:08:59 -0400 (EDT) To: Rich Cullingford Cc: pgsql-interfaces@postgresql.org Subject: Re: Assigning values to array components. In-reply-to: <3F60D485.5030807@sysd.com> References: <3F60D485.5030807@sysd.com> Comments: In-reply-to Rich Cullingford message dated "Thu, 11 Sep 2003 16:01:09 -0400" Date: Thu, 11 Sep 2003 17:08:59 -0400 Message-ID: <1480.1063314539@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/19 X-Sequence-Number: 4437 Rich Cullingford writes: > create or replace function foobaz() > RETURNS bigint[] > AS ' > DECLARE > answer bigint[]; > BEGIN > answer[1] := 12345; > RETURN answer; > END; > ' > LANGUAGE 'plpgsql'; > select foobaz(); > WARNING: plpgsql: ERROR during compile of foobaz near line 4 > ERROR: parse error at or near "[" IIRC, Joe Conway fixed that for 7.4. I can get your example to work in CVS tip if I modify the DECLARE to answer bigint[] = ''{}''; Without that, you're trying to combine a NULL array with a nonnull entry, which is going to give a NULL result. regards, tom lane