proposal: less strict input of regprocedure type

Started by Pavel Stehuleover 7 years ago4 messageshackers
Jump to latest
#1Pavel Stehule
pavel.stehule@gmail.com

Hi

input value of regrocedure type should be complete function signature.

postgres=# select 'uni'::regprocedure;
ERROR: expected a left parenthesis
LINE 1: select 'uni'::regprocedure;
^

I think so it is not necessary, when function name is unique.

plpgsql_check uses regprocedure type parameters often and less strict input
can be more user friendly - almost all business logic functions has uniq
name. I don't propose to change a output. It will be same - complete
function signature.

What do you think about this proposal?

Regards

Pavel

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Pavel Stehule (#1)
Re: proposal: less strict input of regprocedure type

Pavel Stehule <pavel.stehule@gmail.com> writes:

input value of regrocedure type should be complete function signature.
postgres=# select 'uni'::regprocedure;
ERROR: expected a left parenthesis
LINE 1: select 'uni'::regprocedure;
^

Yup.

I think so it is not necessary, when function name is unique.

This doesn't seem like a great idea to me. It will just encourage
people to write brittle code that falls over as soon as the name
isn't unique. Also, if you're willing to assume that it is,
why not just use regproc?

regards, tom lane

#3Pavel Stehule
pavel.stehule@gmail.com
In reply to: Tom Lane (#2)
Re: proposal: less strict input of regprocedure type

so 1. 12. 2018 v 20:49 odesílatel Tom Lane <tgl@sss.pgh.pa.us> napsal:

Pavel Stehule <pavel.stehule@gmail.com> writes:

input value of regrocedure type should be complete function signature.
postgres=# select 'uni'::regprocedure;
ERROR: expected a left parenthesis
LINE 1: select 'uni'::regprocedure;
^

Yup.

I think so it is not necessary, when function name is unique.

This doesn't seem like a great idea to me. It will just encourage
people to write brittle code that falls over as soon as the name
isn't unique. Also, if you're willing to assume that it is,
why not just use regproc?

regproc doesn't allow to specify complete signature when it is necessary.

postgres=# select 'uni(int)'::regproc;
ERROR: function "uni(int)" does not exist
LINE 1: select 'uni(int)'::regproc;
^

The motivation is same like last change of DROP FUNCTION. When the name is
unique, then you should not to write a signature.

Regards

Pavel

Show quoted text

regards, tom lane

#4Pavel Stehule
pavel.stehule@gmail.com
In reply to: Pavel Stehule (#3)
Re: proposal: less strict input of regprocedure type

ne 2. 12. 2018 v 4:52 odesílatel Pavel Stehule <pavel.stehule@gmail.com>
napsal:

so 1. 12. 2018 v 20:49 odesílatel Tom Lane <tgl@sss.pgh.pa.us> napsal:

Pavel Stehule <pavel.stehule@gmail.com> writes:

input value of regrocedure type should be complete function signature.
postgres=# select 'uni'::regprocedure;
ERROR: expected a left parenthesis
LINE 1: select 'uni'::regprocedure;
^

Yup.

I think so it is not necessary, when function name is unique.

This doesn't seem like a great idea to me. It will just encourage
people to write brittle code that falls over as soon as the name
isn't unique. Also, if you're willing to assume that it is,
why not just use regproc?

regproc doesn't allow to specify complete signature when it is necessary.

postgres=# select 'uni(int)'::regproc;
ERROR: function "uni(int)" does not exist
LINE 1: select 'uni(int)'::regproc;
^

The motivation is same like last change of DROP FUNCTION. When the name is
unique, then you should not to write a signature.

We can introduce new type -- "routine_identity", that can be used for \sf,
\ef, ... and for my plpgsql_check too.

Show quoted text

Regards

Pavel

regards, tom lane