I tried nested Composites type.
I got an error like below
thread 'main' panicked at 'error retrieving column 0: error deserializing column 0: cannot convert between the Rust type `pg::models::test_user_list_output::UserListOutput` and the Postgres type `type_user_list_output`'
Isn't there a way to do something?
Or could you support it as a function?
DROP TYPE IF EXISTS type_user_list_input CASCADE;
CREATE TYPE type_user_list_input AS (
id BIGINT
,name TEXT
);
DROP TYPE IF EXISTS type_hobby CASCADE;
CREATE TYPE type_hobby AS (
id BIGINT
,name TEXT
,hobby_kbn TEXT
);
DROP TYPE IF EXISTS type_user_list_output CASCADE;
CREATE TYPE type_user_list_output AS (
user_id BIGINT
,name TEXT
,hobby type_hobby[]
);
CREATE OR REPLACE FUNCTION test_list_user(
p_parameter type_user_list_input
) RETURNS SETOF type_user_list_output AS $FUNCTION$
DECLARE
w_hobbies type_hobby[];
BEGIN
SELECT
ARRAY_AGG(t1.*)
INTO
w_hobbies
FROM
(VALUES (1, 'reading', '00101'), (2, 'movie', '00102')) AS t1(id, name, hobby_kbn)
;
RETURN QUERY SELECT
p_parameter.id
,p_parameter.name
,w_hobbies
;
END;
$FUNCTION$ LANGUAGE plpgsql;
I tried nested Composites type. I got an error like below
Isn't there a way to do something? Or could you support it as a function?