function format doesn't support values with variadic flag

Lists: pgsql-bugs
From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: function format doesn't support values with variadic flag
Date: 2012-09-04 05:05:36
Message-ID: CAFj8pRBnYT7Wr-iLJcDC_Pz_+9Unj0WRZCTWDr8Hf_oc5CkozQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Hello

this code should to work, but it doesn't

postgres=# select format('%s %s', variadic array['Hello','World']);
ERROR: too few arguments for format

postgres=# create or replace function un(variadic integer[])
postgres-# returns setof int as $$ select unnest($1)$$ language sql;
CREATE FUNCTION
postgres=# select un(1,2,3,4);
un
────
1
2
3
4
(4 rows)

postgres=# select un(variadic array[1,2,3]);
un
────
1
2
3
(3 rows)

A problem is in too simple evaluation of "any" parameter - without
check to "VARIADIC" flag

Regards

Pavel Stehule