Search Postgresql Archives

Re: ERROR: array subscript out of range

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

 



chinchu2005 <chinchu2005@xxxxxxxxx> writes:
> declare
> i integer;
> j integer;
> a integer[][];
> begin
> for i in 1..10 loop
> for j in 1..2 loop
> a[i][j]:=i*j;

This isn't going to work --- it implies dynamically resizing the array,
and plpgsql isn't smart enough to do that for a multidimensional array.
Do you actually need a 2-D array here?  If so you'll have to initialize
it to the right dimensions to start with, eg with
	a := '{{1,2,3,4,5,6,7,8,9,10},{1,2,3,4,5,6,7,8,9,10}}';

			regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[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