mixed, named notation support

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема mixed, named notation support
Дата
Msg-id 162867790903042341o477b115dtb6b351dd8ff758cc@mail.gmail.com
обсуждение исходный текст
Ответы Re: mixed, named notation support
Re: mixed, named notation support
Список pgsql-hackers
Hello

I did some cleaning on this feature, and I hope so I solve some Tom's objections

features:
 * PostgreSQL's specific syntax for named parameter: value AS name,
 * Doesn't change rules for defaults,
 * Get defaults for named, mixed notation in planner time.

ToDo: enhance documentation (any volunteer?)

regards
Pavel Stehule

CREATE FUNCTION fx(a int, b int, m int = 1, o int = 0) RETURNS int AS $$
    SELECT ($1 + $2) * $3 + $4
$$ LANGUAGE SQL;

-- positional notation
SELECT fx(10,20);
 fx
----
 30
(1 row)

SELECT fx(10,20,2,50);
  fx
-----
 110
(1 row)

-- named notation
SELECT fx(20 as b, 10 as a);
 fx
----
 30
(1 row)

SELECT fx(20 as b, 10 as a, 50 as o);
 fx
----
 80
(1 row)

-- mixed notation
SELECT fx(10,20, 10 as m);
 fx
-----
 300
(1 row)

SELECT fx(10,20, 50 as o, 2 as m);
 fx
-----
 110
(1 row)

Вложения

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

Предыдущее
От: Xavier Bugaud
Дата:
Сообщение: Re: Patch for the MUST time zone (Mauritius Summer Time)
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: Use array in a dynamic statement