Re: Calling PL functions with named parameters

From: "Jim C(dot) Nasby" <decibel(at)decibel(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: David Fetter <david(at)fetter(dot)org>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Calling PL functions with named parameters
Date: 2004-08-13 22:58:12
Message-ID: 20040813225812.GI87347@decibel.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Aug 13, 2004 at 06:22:25PM -0400, Tom Lane wrote:
> > On a related note, it would also be nice to have default
> > parameters and some way to say to use them.
>
> That is fundamentally not ever going to happen, because it blows
> overloaded-function resolution out of the water: there is no way to
> choose whether "foo(42, 2.5)" matches foo(int, float) or
> foo(int, float, something-with-a-default). Let's try to limit our
> attention to something that might actually work.

Actually, it is possible because Oracle does it. Presumably they treat a
function with defaults as being the equivalent number of overloaded
functions when functions are created, to ensure it can always resolve
what function to call.

IOW, their function resolution code treats a(int, int default 0) as
being equivalent to a(int) and a(int, int).
--
Jim C. Nasby, Database Consultant decibel(at)decibel(dot)org
Give your computer some brain candy! www.distributed.net Team #1828

Windows: "Where do you want to go today?"
Linux: "Where do you want to go tomorrow?"
FreeBSD: "Are you guys coming, or what?"

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2004-08-13 23:02:33 Re: [Fwd: Re: [pgsql-hackers-win32] Import from Linux to Windows]
Previous Message Gaetano Mendola 2004-08-13 22:54:08 Re: Postgres 8.0 -> BEGIN EXCEPTION END Syntax????