From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | PostgreSQL-development Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | mixed, named notation support |
Date: | 2009-03-05 07:41:28 |
Message-ID: | 162867790903042341o477b115dtb6b351dd8ff758cc@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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)
Attachment | Content-Type | Size |
---|---|---|
named_notation_20090305.01.diff | text/x-patch | 48.8 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Heikki Linnakangas | 2009-03-05 07:57:35 | Re: Use array in a dynamic statement |
Previous Message | Xavier Bugaud | 2009-03-05 07:39:33 | Re: Patch for the MUST time zone (Mauritius Summer Time) |