I was trying to write a variadic function where the arguments themselves are arrays, but calling it does not seem to work. I couldn't find documentation mentioning this restriction
postgres=# create or replace function foo(variadic args integer[][]) returns integer as $$ begin return args[2][2]; end; $$ language plpgsql;
postgres=# select foo( array[1,2] , array[3,4] ); ERROR: function foo(integer[], integer[]) does not exist at character 8 HINT: No function matches the given name and argument types. You might need to add explicit type casts. STATEMENT: select foo( array[1,2] , array[3,4] ); ERROR: function foo(integer[], integer[]) does not exist LINE 1: select foo( array[1,2] , array[3,4] ); ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts.
I suspect this has to do something with multiple dimensional arrays not truly being arrays of arrays...
Kind regards,
Ingmar Brouns
version
---------------------------------------------------------------------------------------------------------- ---- PostgreSQL 9.1.1 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.6.1 20110908 (Red Hat 4.6.1-9), 64- bit (1 row)