2d array issues

From: "John Gant" <john(dot)gant(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: 2d array issues
Date: 2007-03-01 05:53:58
Message-ID: f9f875540702282153j65965dcdxa37a6d6c15a9a35d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,
Can anyone tell me why the function below is breaking at the second
assignment? I am trying to set values for columns 1 and 2 for row 1. The
compilation and error are below the function definition. Thanks in advance.

1. CREATE OR REPLACE FUNCTION test() returns void AS $$
2. declare
3. matrix numeric [][];
4. cnt numeric := 1;
5. begin
6. matrix[cnt][1] := 3;
7. raise notice '%', matrix[cnt][1];
8. matrix[cnt][2] := 4;
9. raise notice '%', matrix[cnt][2];
10. end;
11. $$ LANGUAGE plpgsql;
12.
13. error...
14. stocks=# \i test.sql
15. CREATE FUNCTION
16. stocks=# select test();
17. NOTICE: 3
18. ERROR: invalid array subscripts
19. CONTEXT: PL/pgSQL FUNCTION "test" line 7 at assignment

Browse pgsql-general by date

  From Date Subject
Next Message Magnus Hagander 2007-03-01 08:56:52 Re: PG periodic Error on W2K
Previous Message Bruno Wolff III 2007-03-01 03:53:21 Re: [HACKERS] urgent: upgraded to 8.2, getting kernel panics