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

From miller_2555
Subject Multidimensional array definition in composite type appears parsed as string
Date
Msg-id 23749072.post@talk.nabble.com
Whole thread Raw
Responses Re: Multidimensional array definition in composite type appears parsed as string  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Hi -

I am trying to declare an array of the following compound type:
CREATE TYPE myschema.mytype AS (
    sometext            text,
    onedimarray        text[],
    multidimarray        text[][]
);

The current assignment occurs as follows:
    myvar    myschema.mytype[] := ARRAY[

ROW('textaa',ARRAY['textab'],ARRAY[ARRAY['textac1','textac2']])::myschema.mytype,

ROW('textba',ARRAY['textbb'],ARRAY[ARRAY['textbc1','textbc2']])::myschema.mytype
                ];

However, each multidimarray in the assignment appears as a string on the
output from the following statement (declared within a pgSQL function):
statement: RAISE INFO '%',myvar;
outputt: INFO:
{"(textaa,{textab},\"{{textac1,textac2}}\")","(textba,{textbb},\"{{textbc1,textbc2}}\")"}

I believe that I would have expected the following output from the RAISE
INFO statement:
INFO:
{"(textaa,{textab},{{textac1,textac2}})","(textba,{textbb},{{textbc1,textbc2}})"}

I have attempted different explicit typecasts and syntax and have also tried
adding additional elements to the arrays to see if a one-element array was
the cause. So far, I have not been able to access the multidimensional array
in the composite type as an array (though I can perform string functions).
No issues were noted with the one-dimensional array. I would like to retain
a clean definition of the assignment as this variable provides a single
place for programmers to define meta-data used in subsequent dynamic SQL
calls.

Subsequent code attempts to access the multidimensional array elements using
(i,j, and k are iterators):
(myvar[i]).multidimarray[j][k];


How should I amend the assignment syntax so that subsequent code will
recognize the multidimensional arrays?

Thanks for the help.
--
View this message in context:
http://www.nabble.com/Multidimensional-array-definition-in-composite-type-appears-parsed-as-string-tp23749072p23749072.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


pgsql-general by date:

Previous
From: Dimitri Fontaine
Date:
Subject: Re: [PERFORM] Postgres Clustering
Next
From: Alan McKay
Date:
Subject: Re: [PERFORM] Postgres Clustering