Re: Multidimensional array definition in composite type appears parsed as string - Mailing list pgsql-general

From Tom Lane
Subject Re: Multidimensional array definition in composite type appears parsed as string
Date
Msg-id 8334.1243521906@sss.pgh.pa.us
Whole thread Raw
In response to Re: Multidimensional array definition in composite type appears parsed as string  (miller_2555 <nabble.30.miller_2555@spamgourmet.com>)
Responses Re: Multidimensional array definition in composite type appears parsed as string -- SOLVED  (miller_2555 <nabble.30.miller_2555@spamgourmet.com>)
List pgsql-general
miller_2555 <nabble.30.miller_2555@spamgourmet.com> writes:
> I appreciate the clarification on the output. Given the assignment appears
> correct, what is the appropriate method to access the elements of the
> multidimensional array?

I think what you're missing is the distinction between slice and simple
element access, ie instead of this

 (myvar[i]).multidimarray[j]

you'd need something like this

 (myvar[i]).multidimarray[j][1:3]

The proposed loop coding is uselessly overcomplicated because it
supposes that 2-D arrays could be nonrectangular.  Just use array_lower
and array_upper on dimension 2 of the 2-D array in the innermost loop.

You might want to practice a bit with a plain 2-D array field before
getting into the complexity of embedding it in a composite embedded
in an array ...

            regards, tom lane

pgsql-general by date:

Previous
From: inf200468@ucf.edu.cu
Date:
Subject: [Fwd: Re: a modo texto]
Next
From: "Atul Chojar"
Date:
Subject: How to pass parameters into a sql script ?