Re: Odd procedure resolution

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Odd procedure resolution
Date: 2018-05-17 20:10:59
Message-ID: ea1681c5-57e7-bd8b-8932-3e73acaf37bf@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 5/16/18 15:29, Tom Lane wrote:
> My opinion remains unchanged. If you're unhappy about the system
> confusing procedure foo(int) and function foo(real), maybe the answer
> is to not overload the name "foo" with such enthusiasm. But putting
> kluges into (some of) the lookup rules is just going to lead to its
> own problems and surprising results.
>
> In particular, I dislike the idea that this patch would make routine
> names appear unique in some cases when they do not in others.
> Overloading is complicated/confusing enough without that.

I think I have made a mistake here. I was reading in between the lines
of a competitor's documentation that they have functions and procedures
in different name spaces, which made me re-read the SQL standard, which
appears to support that approach.

So I'm proposing here a patch to fix that. It is similar to the patch
proposed earlier in the thread, but more extensive.

One open problem in my patch is that regproc/regprocedure don't have a
way to distinguish functions from procedures. Maybe a two-argument
version of to_regprocedure? This will also affect psql's \ef function
and the like.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment Content-Type Size
v1-0001-Allow-functions-and-procedures-with-the-same-name.patch text/plain 151.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Gierth 2018-05-17 20:42:59 Re: [GSoC] Question about returning bytea array
Previous Message Alvaro Herrera 2018-05-17 20:03:37 Re: Incorrect comment in get_partition_dispatch_recurse