Re: WIP: default values for function parameters

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: WIP: default values for function parameters
Дата
Msg-id 200811301748.43645.peter_e@gmx.net
обсуждение исходный текст
Ответ на Re: WIP: default values for function parameters  ("Pavel Stehule" <pavel.stehule@gmail.com>)
Ответы Re: WIP: default values for function parameters  ("Pavel Stehule" <pavel.stehule@gmail.com>)
Re: WIP: default values for function parameters  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: WIP: default values for function parameters  ("Pavel Stehule" <pavel.stehule@gmail.com>)
Список pgsql-hackers
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).

Comments?


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [BUGS] BUG #4553: HOLD cursors not materializing results fully
Следующее
От: "Pavel Stehule"
Дата:
Сообщение: Re: WIP: default values for function parameters