Function with defval returns wrong result

From: "Rushabh Lathia" <rushabh(dot)lathia(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Cc: rushabh(dot)lathia(at)enterprisedb(dot)com
Subject: Function with defval returns wrong result
Date: 2009-01-05 10:49:59
Message-ID: 460abcb10901050249w490ccaccp66f7c6832b63f290@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi All,

Following test returns wrong result ..

Testcase ( on 8.4 cvs head )
=======================

CREATE OR REPLACE FUNCTION f1(retval VARCHAR DEFAULT 'Argument') RETURNS
VARCHAR as
$$
BEGIN
return retval;
END;
$$ LANGUAGE plpgsql;

CREATE OR REPLACE FUNCTION f2(p1 IN int, p2 IN VARCHAR DEFAULT f1())
RETURNS VARCHAR AS
$$
BEGIN
RETURN p2;
END;
$$ LANGUAGE plpgsql;

postgres=# select f2(10);
f2
----

(1 row)

When we run the f2() it should return the output as the defvalue of f1()
function, but its returning null.

Thanks,
Rushabh Lathia
www.EnterpriseDB.com

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Zdenek Kotala 2009-01-05 12:29:52 Re: version() output vs. 32/64 bits
Previous Message ITAGAKI Takahiro 2009-01-05 10:20:58 Re: Many "loaded library" logs by preload libraries