X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id E48F3CC943 for ; Thu, 17 Jul 2003 11:18:44 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 51405-07 for ; Thu, 17 Jul 2003 11:18:59 +0000 (GMT) Received: from gsy_sbs_1.cisx.com (unknown [213.133.202.58]) by svr1.postgresql.org (Postfix) with ESMTP id C1A91CC8FB for ; Thu, 17 Jul 2003 08:18:32 -0300 (ADT) Received: from DEMOLITION ([192.168.100.22]) by gsy_sbs_1.cisx.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2650.21) id PCH9J12M; Thu, 17 Jul 2003 12:09:53 +0100 Message-ID: <005701c34c55$8d017540$1664a8c0@DEMOLITION> From: "Donald Fraser" To: "[ADMIN]" Subject: Arrays in pl/pgsql functions Date: Thu, 17 Jul 2003 12:21:16 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4927.1200 X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4927.1200 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/148 X-Sequence-Number: 9488 PostgreSQL version 7.3.3 With reference to pl/pgsql functions. I can declare a function to return an array type and I get no complaints when defining or executing it. I can declare a variable within the function as an array type and I don't get any complaints defining or executing the function. When I try to access the array I have problems. I cannot find any documentation on accessing array types so I assumed they would follow the pgSQL notation of for example: CREATE OR REPLACE FUNCTION test_arrays() RETURNS int4[] AS ' DECLARE test int4[]; BEGIN test[1] := 1; RETURN test; END ' LANGUAGE 'plpgsql'; If I try to execute this function I get: WARNING: plpgsql: ERROR during compile of test_arrays near line 5 ERROR: syntax error at or near "[" If I comment out the line: test[1] := 1; then the function executes ok. Could someone be please inform me what the correct syntax for accessing arrays is or tell me if its not possible with pl/pgSQL functions. Thanks in advance, Donald Fraser.