FAQ
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

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-novice @
categoriespostgresql
postedMay 2, '06 at 10:37p
activeMay 2, '06 at 10:37p
posts1
users1
websitepostgresql.org
irc#postgresql

1 user in discussion

James G Wilkinson: 1 post

People

Translate

site design / logo © 2022 Grokbase