Skip site navigation (1) Skip section navigation (2)

function format doesn't support values with variadic flag

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 (view raw or flat)
Thread:
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


pgsql-bugs by date

Next:From: Magnus HaganderDate: 2012-09-04 07:03:47
Subject: Re: BUG #7517: terminated by exception 0xC0000409
Previous:From: katsuhito.habaguchiDate: 2012-09-04 01:00:21
Subject: BUG #7517: terminated by exception 0xC0000409

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group