Search Postgresql Archives

Multidimensional array definition in composite type appears parsed as string

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

 



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.


-- 
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