I want to write a function that accepts array of arrays of my composite type. because of they have different lengths, it can NOT be defined as one array. So, I want to use variadic to accept arrays separately from each other. What can I do to achieve this ?
my type:
create type column_data as
(
"name" text,
"type" text
);
A function that accepts multiple arrays of my type:
create or replace function delete_from_table(table_name regclass, data jsonb, variadic columns column_data[][]) returns jsonb
language plpgsql
as
$BODY$
.
.
.
.
.
$BODY$;
call:
select delete_from_table('cm.clients_rate_limits'::regclass,
'[]'::jsonb,
array [('pk', 'bigint')]::column_data[],
array [('id', 'uuid')]::column_data[],
array [('client_id', 'bigint'), ('rate_limit_id', 'bigint')]::column_data[]
);
error:
[42704] ERROR: could not find array type for data type column_data[]
column_data[]is the same ascolumn_data[][]in PostgreSQL. Perhaps there is some other way to achieve what you want, but I don't understand what you want. What is the function supposed to do, and what is the meaning of the parameters?