I have a function:
my_function(arg1 integer, arg2 text, arg3, text);
I have a view my_view that returns as a row: (arg1, arg2, arg3);
I can call my_function() with the row from the view as I would do explicitely:
select my_function(arg1 , arg2, arg3) from my_view;
but I would like to do it somehow as mass-assignment:
select my_function(my_view.*) from my_view;
or
select my_function(my_view) from my_view
Is there any function that can do transformation for me to be able to do this call this way?
Reason is I plan to have some 20-50 attributes and so writing long expression is not comfortable.
2
Answers
I think it will be the easiest if you create function where you pass whole record.
For example:
If you don’t mind calling it by
select my_function('my_view');
you can overload your function and handle the argument unpacking there:Online demo.