Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a task to pass arrays, records and in some cases array of records as a parameter to the stored procedures in PostgreSQL.

Any ideas?

share|improve this question
up vote 6 down vote accepted

Postgres has very flexible handling of arrays and composite types. This may be the sort of thing you are trying to do:

create type my_type as (val1 integer, val2 integer);

create function my_function(arr in my_type[]) returns text language plpgsql as $$
  return arr::text;

select my_function(array[row(1,2)::my_type, row(3,4)::my_type]);

(1 row)
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.