Search Postgresql Archives

2d array issues

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux