From: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
---|---|
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:13:22 |
Message-ID: | 49461FB2.5050700@gmx.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Rushabh Lathia wrote:
> 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?
In theory yes, but it's currently not that smart. When it considers a
function based on available default values, it does not consider
argument types. So if there is another function with the same number of
arguments, it bails out.
Feel free to propose improvements.
From | Date | Subject | |
---|---|---|---|
Next Message | Pavel Stehule | 2008-12-15 09:15:09 | Re: Function with defval returns error |
Previous Message | Rushabh Lathia | 2008-12-15 09:04:43 | Function with defval returns error |