pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
The keyword in the procedure's error message is "function", which should be "procedure"
4+ messages / 2 participants
[nested] [flat]

* The keyword in the procedure's error message is "function", which should be "procedure"
@ 2022-09-21 09:05  qtds_126 <qtds_126@126.com>
  0 siblings, 2 replies; 4+ messages in thread

From: qtds_126 @ 2022-09-21 09:05 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>

Bug Report
When an existing procedure is created in the database, an error message is prompted for an existing procedure.
But the error message says "function" type.
PostgreSQL version
 11~15
Test SQL

create procedure proc_insert_t_pg_varchar(id int, v varchar)
language plpgsql
as $$
declare
iid int;
vv varchar(5);
begin
iid = id;
vv = v;
insert into t_pg_varchar values(iid, vv);
end;
$$;
Test result



Expected behavior

When an error occurs in procedure, the keyword is changed from "function" to "procedure".

Thanks.

Attachments:

B242659D-884C-454D-928E-426E38915C11.png (image/png, 17.6K) download view image
^ permalink raw reply [nested|flat] 4+ messages in thread

* Re: The keyword in the procedure's error message is "function", which should be "procedure"
@ 2022-09-21 11:46  Junwang Zhao <zhjwpku@gmail.com>
  parent: qtds_126 <qtds_126@126.com>
  1 sibling, 0 replies; 4+ messages in thread

From: Junwang Zhao @ 2022-09-21 11:46 UTC (permalink / raw)
  To: qtds_126 <qtds_126@126.com>; +Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>

I've submitted a patch to resolve this issue, waiting for reviews.

Thanks.

On Wed, Sep 21, 2022 at 7:13 PM qtds_126 <qtds_126@126.com> wrote:

> *Bug Report*
>
> When an existing procedure is created in the database, an error message is
> prompted for an existing procedure.
> But the error message says "function" type.
>
> *PostgreSQL version*
>  11~15
> *Test SQL*
>
> create procedure proc_insert_t_pg_varchar(id int, v varchar)
> language plpgsql
> as $$
> declare
> iid int;
> vv varchar(5);
> begin
> iid = id;
> vv = v;
> insert into t_pg_varchar values(iid, vv);
> end;
> $$;
>
> *Test result*
>
> *Expected behavior*
>
> When an error occurs in procedure, the keyword is changed from "function"
> to "procedure".
>
>
> Thanks.
>


-- 
Regards
Junwang Zhao

Attachments:

B242659D-884C-454D-928E-426E38915C11.png (image/png, 17.6K) download view image
^ permalink raw reply [nested|flat] 4+ messages in thread

* Re: The keyword in the procedure's error message is "function", which should be "procedure"
@ 2022-09-21 15:05  Junwang Zhao <zhjwpku@gmail.com>
  parent: qtds_126 <qtds_126@126.com>
  1 sibling, 1 reply; 4+ messages in thread

From: Junwang Zhao @ 2022-09-21 15:05 UTC (permalink / raw)
  To: qtds_126 <qtds_126@126.com>; +Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>

hi qtds_123,

After some discussion with the hacker lists, this should not be considered
a bug.

quote from tom lane's comments:

More generally: there are probably dozens, if not hundreds, of
messages in the backend that say "function" but nowadays might
also be talking about a procedure.  I'm not sure there's value
in improving just one of them.

I am pretty sure that we made an explicit decision some time back
that it is okay to say "function" when the object could also be
an aggregate or window function.  So you could at least cut this
back to just handling "procedure" and "function".  Or you could
change it to "routine" as Julien suggests, but I think a lot of
people will not think that's an improvement.

see thread [1] for more information.

[1]:
https://www.postgresql.org/message-id/CAEG8a3K6kQmFJz6D2VB50wQTN6VRBGC7C%2BDBh20kkxH-1haW8Q%40mail.g...


On Wed, Sep 21, 2022 at 7:13 PM qtds_126 <qtds_126@126.com> wrote:

> *Bug Report*
>
> When an existing procedure is created in the database, an error message is
> prompted for an existing procedure.
> But the error message says "function" type.
>
> *PostgreSQL version*
>  11~15
> *Test SQL*
>
> create procedure proc_insert_t_pg_varchar(id int, v varchar)
> language plpgsql
> as $$
> declare
> iid int;
> vv varchar(5);
> begin
> iid = id;
> vv = v;
> insert into t_pg_varchar values(iid, vv);
> end;
> $$;
>
> *Test result*
>
> *Expected behavior*
>
> When an error occurs in procedure, the keyword is changed from "function"
> to "procedure".
>
>
> Thanks.
>


-- 
Regards
Junwang Zhao

Attachments:

B242659D-884C-454D-928E-426E38915C11.png (image/png, 17.6K) download view image
^ permalink raw reply [nested|flat] 4+ messages in thread

* Re:  The keyword in the procedure's error message is "function", which should be "procedure"
@ 2022-09-22 06:53  qtds_126 <qtds_126@126.com>
  parent: Junwang Zhao <zhjwpku@gmail.com>
  0 siblings, 0 replies; 4+ messages in thread

From: qtds_126 @ 2022-09-22 06:53 UTC (permalink / raw)
  To: zhjwpku@gmail.com <zhjwpku@gmail.com>; +Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>

Hi Zhao



Thank you for your reply, I understand.
The issue can be considered as a suggested feature improvement.
I think it would be better to use the keyword "procedure" in the error message if we can be sure that it is indeed a procedure error. This will not be misunderstood by the user.

Thank you.



| |
Xintang Liu
|
|
qtds_126@126.com
|
---- Replied Message ----
| From | Junwang Zhao<zhjwpku@gmail.com> |
| Date | 9/21/2022 23:05 |
| To | qtds_126<qtds_126@126.com> |
| Cc | pgsql-bugs@lists.postgresql.org<pgsql-bugs@lists.postgresql.org> |
| Subject | Re: The keyword in the procedure's error message is "function", which should be "procedure" |
hi qtds_123,


After some discussion with the hacker lists, this should not be considered a bug.


quote from tom lane's comments:


More generally: there are probably dozens, if not hundreds, of
messages in the backend that say "function" but nowadays might
also be talking about a procedure.  I'm not sure there's value
in improving just one of them.

I am pretty sure that we made an explicit decision some time back
that it is okay to say "function" when the object could also be
an aggregate or window function.  So you could at least cut this
back to just handling "procedure" and "function".  Or you could
change it to "routine" as Julien suggests, but I think a lot of
people will not think that's an improvement.



see thread [1] for more information.


[1]: https://www.postgresql.org/message-id/CAEG8a3K6kQmFJz6D2VB50wQTN6VRBGC7C%2BDBh20kkxH-1haW8Q%40mail.g...




On Wed, Sep 21, 2022 at 7:13 PM qtds_126 <qtds_126@126.com> wrote:

Bug Report
When an existing procedure is created in the database, an error message is prompted for an existing procedure.
But the error message says "function" type.
PostgreSQL version
 11~15
Test SQL

create procedure proc_insert_t_pg_varchar(id int, v varchar)
language plpgsql
as $$
declare
iid int;
vv varchar(5);
begin
iid = id;
vv = v;
insert into t_pg_varchar values(iid, vv);
end;
$$;
Test result



Expected behavior

When an error occurs in procedure, the keyword is changed from "function" to "procedure".

Thanks.




--

Regards

Junwang Zhao

Attachments:

B242659D-884C-454D-928E-426E38915C11.png (image/png, 17.6K) download view image
^ permalink raw reply [nested|flat] 4+ messages in thread


end of thread, other threads:[~2022-09-22 06:53 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-09-21 09:05 The keyword in the procedure's error message is "function", which should be "procedure" qtds_126 <qtds_126@126.com>
2022-09-21 11:46 ` Junwang Zhao <zhjwpku@gmail.com>
2022-09-21 15:05 ` Junwang Zhao <zhjwpku@gmail.com>
2022-09-22 06:53   ` qtds_126 <qtds_126@126.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox