Inconsistent format() behavior for argument-count inconsistency

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: Inconsistent format() behavior for argument-count inconsistency
Date: 2013-01-18 18:03:13
Message-ID: 10550.1358532193@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

regression=# select format('%s %s', 'foo', 'bar');
format
---------
foo bar
(1 row)

regression=# select format('%s %s', 'foo', 'bar', 'baz');
format
---------
foo bar
(1 row)

regression=# select format('%s %s', 'foo');
ERROR: too few arguments for format

Why do we throw an error for too few arguments, but not too many?

(This came up when I started wondering whether the proposed VARIADIC
feature would really be very useful for format(), since it needs a
format string that matches up with its arguments.)

regards, tom lane

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2013-01-18 18:03:26 Re: Event Triggers: adding information
Previous Message Stephen Frost 2013-01-18 17:45:02 Re: in-catalog Extension Scripts and Control parameters (templates?)