why VARIADIC functions executed on array input?

From: Tjibbe <tjibbe(at)rijpma(dot)org>
To: PostgreSQL mailing lists <pgsql-general(at)postgresql(dot)org>
Subject: why VARIADIC functions executed on array input?
Date: 2014-02-19 14:17:44
Message-ID: CAF_dx10Gr0DEbByJOMfZ5TVCsr26NxagV4bH6KX2u1pg+fPv=g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

CREATE FUNCTION foo (VARIADIC anyarray) RETURNS void AS $$
DECLARE
BEGIN
END
$$ LANGUAGE plpgsql;
SELECT foo (ARRAY[1]);

I would expect an error: Like:
ERROR: function f3oo(integer[]) does not exist

But I get this error:
ERROR: could not find array type for data type integer[]

Why VARIADIC functions are found on array input? In my opinion it
makes no sense and the disadvantage is that overloading with a
function like: CREATE OR REPLACE FUNCTION foo (anyarray) doesn't
work.

Greetings Tjibbe

see example in: http://sqlfiddle.com/#!15/300e8/1

--
+31 6 29401726
tjibbe(at)rijpma(dot)org
Jacobusstraat 185
3012 JM Rotterdam

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dev Kumkar 2014-02-19 14:19:19 Timezone information
Previous Message Jürgen Fuchsberger 2014-02-19 13:20:33 Re: File system level backup of shut down standby does not work?