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.
CREATE OR REPLACE FUNCTION test() returns void AS $$ declare matrix numeric [] []; cnt numeric := 1; begin matrix[cnt] [1] := 3; raise notice '%', matrix[cnt ][1]; matrix[cnt] [2] := 4; raise notice '%', matrix[cnt ][2]; end; $$ LANGUAGE plpgsql; error... stocks=# \i test.sql CREATE FUNCTION stocks=# select test(); NOTICE: 3 ERROR: invalid array subscripts CONTEXT: PL/pgSQL FUNCTION "test" line 7 at assignment