Re: Function with defval returns error

From: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
To: "Rushabh Lathia" <rushabh(dot)lathia(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, rushabh(dot)lathia(at)enterprisedb(dot)com
Subject: Re: Function with defval returns error
Date: 2008-12-15 09:15:09
Message-ID: 162867790812150115w1efd3960n7387127c6295118a@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello

2008/12/15 Rushabh Lathia <rushabh(dot)lathia(at)gmail(dot)com>:
> Hi All,
>
> Following test returns error on 8.4 cvs head. it looks like an issue
>
> Testcase: (8.4 CVS head)
> ====================
> CREATE OR REPLACE FUNCTION f007( a INTEGER,
> b INTEGER DEFAULT 10 ) RETURNS INTEGER
> AS $$
> select 10;
> $$ language sql;
>
> CREATE OR REPLACE FUNCTION f007( a INTEGER DEFAULT 10,
> b INTEGER DEFAULT 10,
> c INTEGER DEFAULT 10) RETURNS INTEGER
> AS $$
> select 10;
> $$ language sql;
>
> CREATE OR REPLACE FUNCTION f007( a TIMESTAMP DEFAULT to_date('01-JUN-06
> 14:03:50', 'DD-MON-YY HH24:MI:SS') ) RETURNS TIMESTAMP
> AS $$
> select current_date::timestamp;
> $$ language sql;
>
> postgres=# SELECT f007( to_date('01-JUN-06 14:03:50', 'DD-MON-YY
> HH24:MI:SS') );
> ERROR: functions with parameter defaults f007(integer, integer, integer)
> and f007(integer, integer) are ambiguous
>
>
> I think this should not return error as the input args here is timestamp...
> inputs?
>

you are right - this is known problem - because postgresql identify
ambigonous calling and choise the best function in two places - simply
we identify ambigonous call to early (algoritm is more fast then
smart) - so ugly efect is identifivation of stored ambiguous functions
when you call other function with same name.

Pavel

> Thanks,
> Rushabh Lathia
> www.EnterpriseDB.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message 汪琦 2008-12-15 09:17:54 About debug means ---How to debug a function seperately in an easy way?
Previous Message Peter Eisentraut 2008-12-15 09:13:22 Re: Function with defval returns error