Re: [HACKERS] Function with default value not replacing old definition of the function

2008-12-11 Thread Tom Lane
Pavel Stehule [EMAIL PROTECTED] writes: no, it's little bit different Default is only stored parameter value. You created two functions with two different signatures myfunc(int) myfunc(int, int) Yeah, we already bit this bullet with variadic functions --- if you have myfunc(int,

Re: [HACKERS] Function with default value not replacing old definition of the function

2008-12-11 Thread Dimitri Fontaine
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, Le 11 déc. 08 à 16:22, Tom Lane a écrit : Yeah, we already bit this bullet with variadic functions --- if you have myfunc(int, float) myfunc(int, variadic float[]) then it's ambiguous which one should be used for call

Re: [HACKERS] Function with default value not replacing old definition of the function

2008-12-11 Thread Tom Lane
Dimitri Fontaine dfonta...@hi-media.com writes: The sanest answer I can see is so, don't do that. Is there any warning level message at CREATE FUNCTION time for the user/dba to know he's doing something... border line, almost shooting himself in the foot? It's not that easy to produce a

Re: [HACKERS] Function with default value not replacing old definition of the function

2008-12-11 Thread Dimitri Fontaine
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Le 11 déc. 08 à 21:23, Tom Lane a écrit : It's not that easy to produce a message that wouldn't be annoying noise. Something really amazing in PostgreSQL is the HINTs system in error messages. Almost all the time thoses messages are focused and

[HACKERS] Function with default value not replacing old definition of the function

2008-12-10 Thread Rushabh Lathia
Hi, Testcase: (8.4 CVS head) CREATE OR REPLACE FUNCTION myfunc(y int) RETURNS INTEGER AS $$ select 100; $$ language sql; CREATE OR REPLACE FUNCTION myfunc(y int, x integer DEFAULT 100) RETURNS INTEGER AS $$ select 200; $$ language sql; select myfunc(10); myfunc

Re: [HACKERS] Function with default value not replacing old definition of the function

2008-12-10 Thread Peter Eisentraut
Rushabh Lathia wrote: Hi, Testcase: (8.4 CVS head) CREATE OR REPLACE FUNCTION myfunc(y int) RETURNS INTEGER AS $$ select 100; $$ language sql; CREATE OR REPLACE FUNCTION myfunc(y int, x integer DEFAULT 100) RETURNS INTEGER AS $$ select 200; $$ language sql;

Re: [HACKERS] Function with default value not replacing old definition of the function

2008-12-10 Thread Rushabh Lathia
On Thu, Dec 11, 2008 at 12:33 PM, Peter Eisentraut [EMAIL PROTECTED] wrote: Rushabh Lathia wrote: Hi, Testcase: (8.4 CVS head) CREATE OR REPLACE FUNCTION myfunc(y int) RETURNS INTEGER AS $$ select 100; $$ language sql; CREATE OR REPLACE FUNCTION myfunc(y int,

Re: [HACKERS] Function with default value not replacing old definition of the function

2008-12-10 Thread Pavel Stehule
Hello 2008/12/11 Rushabh Lathia [EMAIL PROTECTED]: Hi, Testcase: (8.4 CVS head) CREATE OR REPLACE FUNCTION myfunc(y int) RETURNS INTEGER AS $$ select 100; $$ language sql; CREATE OR REPLACE FUNCTION myfunc(y int, x integer DEFAULT 100) RETURNS INTEGER AS $$

Re: [HACKERS] Function with default value not replacing old definition of the function

2008-12-10 Thread Rushabh Lathia
On Thu, Dec 11, 2008 at 12:40 PM, Pavel Stehule [EMAIL PROTECTED]wrote: Hello 2008/12/11 Rushabh Lathia [EMAIL PROTECTED]: Hi, Testcase: (8.4 CVS head) CREATE OR REPLACE FUNCTION myfunc(y int) RETURNS INTEGER AS $$ select 100; $$ language sql;

Re: [HACKERS] Function with default value not replacing old definition of the function

2008-12-10 Thread Pavel Stehule
2008/12/11 Rushabh Lathia [EMAIL PROTECTED]: On Thu, Dec 11, 2008 at 12:40 PM, Pavel Stehule [EMAIL PROTECTED] wrote: Hello when you created function, we cannot check defaults, because we don't know if anybody use default or not. And when you call function, then postgres prefer function

Re: [HACKERS] Function with default value not replacing old definition of the function

2008-12-10 Thread Rushabh Lathia
On Thu, Dec 11, 2008 at 12:59 PM, Pavel Stehule [EMAIL PROTECTED]wrote: 2008/12/11 Rushabh Lathia [EMAIL PROTECTED]: On Thu, Dec 11, 2008 at 12:40 PM, Pavel Stehule [EMAIL PROTECTED] wrote: Hello when you created function, we cannot check defaults, because we don't know if