Re: Function with defval returns error

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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-18 18:22:17
Message-ID: 10142.1229624537@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Rushabh Lathia" <rushabh(dot)lathia(at)gmail(dot)com> writes:
> 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...

This is fixed in my recent commit --- the ambiguous-function error won't
occur unless the ambiguous functions represent the best match to the
actual arguments.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-12-18 18:24:15 Re: Function with defval returns error
Previous Message Simon Riggs 2008-12-18 17:47:35 Re: Latest version of Hot Standby patch