Check out CREATE TYPE
in the manual.
Your example defines the type allvalues_t
, but later uses allvalues
. Also values_t
-> value_t
. Looks like a simple typos. You can't be that sloppy if you want to get it right.
Syntax of for composite could be type:
SELECT * from foo(('{"(\"(\"\"{arr_a,arr_b}\"\")\",\"(foo,bar)\")","(\"(\"\"{arr_a,arr_b}\"\")\",\"(foo,bar)\")"}'))
How can you find out yourself?
CREATE TEMP TABLE pairs_t (keyname varchar, e_value varchar);
-- OR CREATE TYPE for a more permanent solution.
INSERT INTO pairs_t VALUES ('foo', 'bar');
CREATE TEMP TABLE values_t (e_values varchar[]);
INSERT INTO values_t VALUES ('{arr_a, arr_b}');
CREATE TEMP TABLE allvalues_t (regions values_t, products pairs_t);
INSERT INTO allvalues_t VALUES((SELECT x FROM values_t x), (SELECT x FROM pairs_t x));
CREATE TEMP TABLE test (t allvalues_t[]);
INSERT INTO test VALUES (ARRAY[(SELECT x FROM allvalues_t x), (SELECT x FROM allvalues_t x)]);
SELECT * FROM test
SELECT x FROM allvalues_t x;