Re: [HACKERS] Function with defval returns error

2008-12-18 Thread Peter Eisentraut
Tom Lane wrote: This case *must* work: create function foo (f1 int) create function foo (f1 int, f2 int = 42) select foo(10) and it seems like just an arbitrary exception if you don't have a rule about preferring fewer defaults over more. I tried out C++, and it

Re: [HACKERS] Function with defval returns error

2008-12-18 Thread Tom Lane
Peter Eisentraut pete...@gmx.net writes: Tom Lane wrote: This case *must* work: create function foo (f1 int) create function foo (f1 int, f2 int = 42) select foo(10) I tried out C++, and it rejects this case: ... So, I'd rather reject the foo(10) call. The least-defaults rule doesn't

Re: [HACKERS] Function with defval returns error

2008-12-18 Thread Tom Lane
Rushabh Lathia rushabh.lat...@gmail.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,

Re: [HACKERS] Function with defval returns error

2008-12-18 Thread Tom Lane
Rushabh Lathia rushabh.lat...@gmail.com writes: Another issue found on CVS head ... postgres= select f_test(10); ERROR: cache lookup failed for type 2139062142 I had some difficulty reproducing this locally. Would you check it's fixed by latest commit? regards,

Re: [HACKERS] Function with defval returns error

2008-12-18 Thread Pavel Stehule
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 I did some fast test, and now, it is well, so thank you regards Pavel Stehule -- Sent

Re: [HACKERS] Function with defval returns error

2008-12-18 Thread Rushabh Lathia
On Thu, Dec 18, 2008 at 11:54 PM, Tom Lane t...@sss.pgh.pa.us wrote: Rushabh Lathia rushabh.lat...@gmail.com writes: Another issue found on CVS head ... postgres= select f_test(10); ERROR: cache lookup failed for type 2139062142 I had some difficulty reproducing this locally.

Re: [HACKERS] Function with defval returns error

2008-12-16 Thread Pavel Stehule
2008/12/16 Rushabh Lathia rushabh.lat...@gmail.com: On Tue, Dec 16, 2008 at 5:35 PM, Pavel Stehule pavel.steh...@gmail.com wrote: 2008/12/16 Rushabh Lathia rushabh.lat...@gmail.com: When we find the (pathpos prevResult-pathpos) into FuncnameGetCandidates(), we just replacing the

Re: [HACKERS] Function with defval returns error

2008-12-16 Thread Pavel Stehule
2008/12/16 Rushabh Lathia rushabh.lat...@gmail.com: When we find the (pathpos prevResult-pathpos) into FuncnameGetCandidates(), we just replacing the prevResult with the newResult. While replacing the previous with new we do not replace the args. I think in case of default we need to take

Re: [HACKERS] Function with defval returns error

2008-12-16 Thread Rushabh Lathia
On Tue, Dec 16, 2008 at 5:35 PM, Pavel Stehule pavel.steh...@gmail.comwrote: 2008/12/16 Rushabh Lathia rushabh.lat...@gmail.com: When we find the (pathpos prevResult-pathpos) into FuncnameGetCandidates(), we just replacing the prevResult with the newResult. While replacing the

Re: [HACKERS] Function with defval returns error

2008-12-16 Thread Tom Lane
Pavel Stehule pavel.steh...@gmail.com writes: I'll write patch that block creating all ambiguous overloading. Don't bother --- it's a useless solution because you can't guarantee that concurrent insertions into pg_proc won't create an ambiguous situation. You have to define the resolution rules

[HACKERS] Function with defval returns error

2008-12-15 Thread Rushabh Lathia
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

Re: [HACKERS] Function with defval returns error

2008-12-15 Thread Peter Eisentraut
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

Re: [HACKERS] Function with defval returns error

2008-12-15 Thread Pavel Stehule
Hello 2008/12/15 Rushabh Lathia rushabh.lat...@gmail.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 $$

Re: [HACKERS] Function with defval returns error

2008-12-15 Thread Tom Lane
Peter Eisentraut pete...@gmx.net writes: Rushabh Lathia wrote: 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. This is truly horrid. Was that patch *really* ready to commit? I noticed some comments added

Re: [HACKERS] Function with defval returns error

2008-12-15 Thread Peter Eisentraut
On Monday 15 December 2008 15:43:00 Tom Lane wrote: Peter Eisentraut pete...@gmx.net writes: Rushabh Lathia wrote: 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. This is truly horrid. Was that

Re: [HACKERS] Function with defval returns error

2008-12-15 Thread Rushabh Lathia
Another issue found on CVS head CREATE USER test WITH PASSWORD 'test'; CREATE SCHEMA AUTHORIZATION test; CREATE OR REPLACE FUNCTION f_test(x in numeric) RETURNS numeric as $$ BEGIN RETURN x; END; $$ language plpgsql; select f_test(10); \c postgres test; select f_test(10); CREATE OR

Re: [HACKERS] Function with defval returns error

2008-12-15 Thread Pavel Stehule
Hello I'll write patch that block creating all ambiguous overloading. Regards Pavel Stehule 2008/12/16 Rushabh Lathia rushabh.lat...@gmail.com: Another issue found on CVS head CREATE USER test WITH PASSWORD 'test'; CREATE SCHEMA AUTHORIZATION test; CREATE OR REPLACE FUNCTION

Re: [HACKERS] Function with defval returns error

2008-12-15 Thread Rushabh Lathia
When we find the (pathpos prevResult-pathpos) into FuncnameGetCandidates(), we just replacing the prevResult with the newResult. While replacing the previous with new we do not replace the args. I think in case of default we need to take care for the args as well. Thanks, Rushabh On Tue, Dec