WIP: default values for function parameters

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема WIP: default values for function parameters
Дата
Msg-id 162867790810260354y1ad430dx78b11e0443098135@mail.gmail.com
обсуждение исходный текст
Ответы Re: WIP: default values for function parameters  (Alvaro Herrera <alvherre@commandprompt.com>)
Список pgsql-hackers
Hello

attached patch allows to define for any PL language default values for
parameters.

Example:
postgres=# create function fx(a int, b int default 30, c int default 40)
postgres-# returns int as $$ select $1 + $2 + $3; $$
postgres-# language sql;
CREATE FUNCTION
postgres=# select fx();
ERROR:  function fx() does not exist
LINE 1: select fx();
               ^
HINT:  No function matches the given name and argument types. You
might need to add explicit type casts.
postgres=# select fx(10);
 fx
----
 80
(1 row)

postgres=# select fx(10,11);
 fx
----
 61
(1 row)

postgres=# select fx(10,11,12);
 fx
----
 33
(1 row)

Know bugs:
blind ambiguous call detection

comments, ideas?

regards
Pavel Stehule

Вложения

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

Предыдущее
От: "Pavel Stehule"
Дата:
Сообщение: WIP: default values for function parameters
Следующее
От: Jeff Davis
Дата:
Сообщение: new correlation metric