From: | James G Wilkinson <jgw(at)alpinegeophysics(dot)com> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | Multidimensional Arrays |
Date: | 2006-05-02 21:37:33 |
Message-ID: | 4457D11D.8060105@alpinegeophysics.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
I am trying to implement the following simple function:
create or replace function test() returns void as
'
declare
x float[][];
tmp float;
begin
x[100][100] := -9999.9999;
x[3][1] := 20.0;
x[4][20] := 40.0;
tmp := x[3][1];
raise notice ''tmp = %'', tmp;
tmp := x[4][20];
raise notice ''tmp = %'', tmp;
return;
end;
'
language 'plpgsql';
When I execute the function:
db_test=# select test();
It bombs with the following message:
ERROR: invalid array subscripts
CONTEXT: PL/pgSQL function "test" line 10 at assignment
line 10, near as I can tell, is the assignment "x[3][1] := 20.0;"
I am running PostgreSQL 8.1.3
I have done some digging in the archives and found that I can supposedly
initialize the array x as "x := '{}'" but this did not solve the problem.
Of note, when I enter the function, I have no idea what the array
dimensions are. However, I have even tried declaring x as x[100][100]
with the same error result. Can anyone provide some advice?
Regards,
Jim
From | Date | Subject | |
---|---|---|---|
Next Message | Anthony Ettinger | 2006-05-02 23:56:54 | client-only for linux? |
Previous Message | Tomeh, Husam | 2006-05-02 15:02:56 | Re: stress tests problems |