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

WIP: default values for function parameters

From: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
To: "postgres hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: WIP: default values for function parameters
Date: 2008-10-26 11:28:52
Message-ID: 162867790810260428p56d16352qa1ec5c4c5330f25c@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
Hello

I have problem with sending patch, so I am send link
http://www.pgsql.cz/patches/defaults.diff.gz

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

Responses

pgsql-hackers by date

Next:From: Martijn van OosterhoutDate: 2008-10-26 13:49:44
Subject: Re: new correlation metric
Previous:From: Pavel StehuleDate: 2008-10-26 10:54:28
Subject: WIP: default values for function parameters

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