pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Wolfgang Walther <walther@technowledgy.de>
To: pgsql-bugs@lists.postgresql.org
Subject: Calling variadic function with default value in named notation
Date: Wed, 28 Oct 2020 22:02:02 +0100
Message-ID: <5a80bcdb-e92a-5c21-d923-f3813543771b@technowledgy.de> (raw)

Hi,

I tried the following on PG 12.4 and PG 13.0:


create function a(x int, y int[] default '{}')
returns void language sql as '';

create function b(x int, variadic y int[] default '{}')
returns void language sql as '';

-- 1
select a(1, '{2}');
-- 2
select b(1, 2);
-- 3
select a(x=>1, y=>'{2}');
-- 4
select b(x=>1, variadic y=>'{2}');
-- 5
select a(1);
-- 6
select b(1);
-- 7
select a(x=>1);
-- 8
select b(x=>1);


The first 7 calls succeed, but the last one is failing with:


ERROR: function b(x => integer) does not exist
LINE 1: select b(x=>1);
                ^
HINT: No function matches the given name and argument types. You might 
need to add explicit type casts.


So while I am able to call the variadic function in named notation (call 
4) or with the default value (call 6) - I am not able to put both 
together in call 8.

I could not find anything in the documentation that points this out as a 
limitation, so I expected this to work. Did I miss anything?

Thanks

Wolfgang





view thread (10+ messages)  latest in thread

Message-ID: <5a80bcdb-e92a-5c21-d923-f3813543771b@technowledgy.de>
Permalink:  ../5a80bcdb-e92a-5c21-d923-f3813543771b@technowledgy.de/
Also on:    postgresql.org/message-id/5a80bcdb-e92a-5c21-d923-f3813543771b@technowledgy.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: walther@technowledgy.de, pgsql-bugs@lists.postgresql.org
  Subject: Re: Calling variadic function with default value in named notation
  In-Reply-To: <5a80bcdb-e92a-5c21-d923-f3813543771b@technowledgy.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox