Re: proposal: generic function, constructor function

From: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Pgsql Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal: generic function, constructor function
Date: 2008-01-18 22:06:41
Message-ID: 162867790801181406jecc8f1bl7e327e5950c1ec5a@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 18/01/2008, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com> writes:
> > On 18/01/2008, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> >> Can't you do that already with ANYELEMENT, or at the worst ANY?
>
> > I would to have independent parameters and move type checking to
> > function.
>
> Okay, then you want ANY.
>
> > Then I don't need register function exactly and then I can
> > have different numbers of arguments.
>
> The different-numbers-of-arguments bit is what I'm objecting to.
> Just register the function as foo(ANY), foo(ANY,ANY), foo(ANY,ANY,ANY),
> etc, and you're done without breaking anything else.

It's what I unlike - but maybe. But I am not able create function with
ANY params. Is it possible do it via CREATE FUNCTION .. ?

>
> > we can use partial unique index, if it is possible - I didn't test it.
>
> It's not --- partial indexes on system catalogs are not supported, and
> pg_proc is certainly one catalog that that restriction will never be
> relaxed for. (How you going to execute a predicate without doing
> function lookups?) I don't believe that the constraint could be
> expressed as a partial index predicate anyway --- how will you say
> that foo(...) and foo(int) conflict, but foo(int) and foo(int,int)
> don't?
>

no, I spoke about constraint - there can be only one function
foo(anyparams) or any current functions. So lookup find nearest
function or find generic function.

Current implementation ensure unique params for overloaded functions
without unique index too - so I thing Its possible. It's same
mechanism.

regards
Pavel Stehule

> regards, tom lane
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2008-01-18 22:21:23 Re: Recent pg_regress changes break testing under SELinux
Previous Message Tom Lane 2008-01-18 21:57:52 Re: Recent pg_regress changes break testing under SELinux