Skip site navigation (1) Skip section navigation (2)

Re: WIP: default values for function parameters

From: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
To: "Peter Eisentraut" <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: WIP: default values for function parameters
Date: 2008-11-30 16:09:28
Message-ID: 162867790811300809s70d4d936r640ce586e2619423@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
2008/11/30 Peter Eisentraut <peter_e(at)gmx(dot)net>:
> On Thursday 27 November 2008 00:14:19 Pavel Stehule wrote:
>> I am sending actualized versions - I accepted Tom's comments - default
>> expressions are serialised List stored in text field.
>
> OK, this is looking pretty good.
>
> There is a structural problem that we need to address.  With your patch,
> pg_dump produces something like this:
>
> CREATE FUNCTION foo(a integer = 1, b integer = 2, c integer = 3) RETURNS
> integer
>    LANGUAGE sql
>    AS $_$ SELECT $1 + $2 + $3; $_$;
>
> ALTER FUNCTION public.foo(a integer = 1, b integer = 2, c integer = 3) OWNER
> TO peter;
>
>
> The second command is rejected because default values are only accepted in
> CREATE FUNCTION.
>
> There are two ways to fix this, both having some validity:
>
> 1. We create a second version of pg_get_function_arguments() that produces
> arguments without default values decoration.  This is probably the
> technically sound thing to do.
>
> 2. We accept the default values specification and ignore it silently.  Note
> that we already silently ignore the argument names.  ALTER FUNCTION foo(a
> int, b int) will also act on a function defined as foo(x int, y int).
>

if this variant is possible, then will be simply implemented

regard
Pavel

> Comments?
>

In response to

pgsql-hackers by date

Next:From: Tom LaneDate: 2008-11-30 17:49:31
Subject: Re: WIP: default values for function parameters
Previous:From: Peter EisentrautDate: 2008-11-30 15:48:42
Subject: Re: WIP: default values for function parameters

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group