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

Поиск
Список
Период
Сортировка
Искать
От
Peter Eisentraut
Тема
Re: Function with default value not replacing old definition of the function
Дата
Msg-id
4940BB3A.5060206@gmx.net
Ответ на
Список
Дерево обсуждения
Function with default value not replacing old definition of the function "Rushabh Lathia" <rushabh.lathia@gmail.com>
Re: Function with default value not replacing old definition of the function "Pavel Stehule" <pavel.stehule@gmail.com>
Re: Function with default value not replacing old definition of the function "Rushabh Lathia" <rushabh.lathia@gmail.com>
Re: Function with default value not replacing old definition of the function "Pavel Stehule" <pavel.stehule@gmail.com>
Re: Function with default value not replacing old definition of the function "Rushabh Lathia" <rushabh.lathia@gmail.com>
Re: Function with default value not replacing old definition of the function Tom Lane <tgl@sss.pgh.pa.us>
Re: Function with default value not replacing old definition of the function Dimitri Fontaine <dfontaine@hi-media.com>
Re: Function with default value not replacing old definition of the function Tom Lane <tgl@sss.pgh.pa.us>
Re: Function with default value not replacing old definition of the function Dimitri Fontaine <dfontaine@hi-media.com>
Re: Function with default value not replacing old definition of the function Peter Eisentraut <peter_e@gmx.net>
Re: Function with default value not replacing old definition of the function "Rushabh Lathia" <rushabh.lathia@gmail.com>
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;
> 
> select myfunc(10);
> 
>  myfunc
> ----------
>       100
> (1 row)
> 
> When create the same function again by added one default value, while 
> calling the function old function getting called.
> 
> It seems that, function with defval not making any sense, if we want to 
> call the new function then we need to pass defval as well.

Hmm, good point, but I'm not sure that replacing the old function is 
always right.  For example, someone recently requested being able to say

select myfunc(10, DEFAULT);

so there would be some value to having both variants.

Do you have any comparisons with other systems (Oracle?) or other 
programming languages?

В списке pgsql-hackers по дате отправления
От: Rushabh Lathia
Дата:
От: Rushabh Lathia
Дата:
FAQ