Re: variadic array arguments, can it work?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ingmar Brouns <swingi(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: variadic array arguments, can it work?
Date: 2012-01-19 16:06:33
Message-ID: 22276.1326989193@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ingmar Brouns <swingi(at)gmail(dot)com> writes:
> 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[][])

The reason that doesn't work the way you're expecting is that
1-dimensional integer arrays are not a distinct datatype from
2-dimensional integer arrays. The system just sees "variadic int[]"
and expects simple integers in a variadic expansion. Sorry.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2012-01-19 16:49:15 Re: On duplicate ignore
Previous Message Ingmar Brouns 2012-01-19 15:56:32 variadic array arguments, can it work?