diff --git a/src/bin/pg_dump/pg_dump.cpp b/src/bin/pg_dump/pg_dump.cpp index 864880ad9be34dfcbefb4270fc77965069bdbb8e..c434ba20be7561e2c6751099b577366e7b344a96 100644 --- a/src/bin/pg_dump/pg_dump.cpp +++ b/src/bin/pg_dump/pg_dump.cpp @@ -13444,7 +13444,11 @@ static void dumpFunc(Archive* fout, FuncInfo* finfo) } } - appendPQExpBuffer(labelq, "%s %s\n", funcKind, funcsig); + /* + * since COMMENT ON PROCEDURE and ALTER EXTENSION ADD PROCEDURE are not valid in grammar + * COMMENT ON/ALTER EXTENSION ADD, we should use FUNCTION instead. + */ + appendPQExpBuffer(labelq, "%s %s\n", "FUNCTION", funcsig); if (binary_upgrade) binary_upgrade_extension_member(q, &finfo->dobj, labelq->data); diff --git a/src/test/regress/input/gs_dump_tableof.source b/src/test/regress/input/gs_dump_tableof.source index 66f5675a55295557ab641093e374f6145de6273c..e016aeb61a3df2eb081d6d303aa6905ff2dc8607 100644 --- a/src/test/regress/input/gs_dump_tableof.source +++ b/src/test/regress/input/gs_dump_tableof.source @@ -13,6 +13,10 @@ create type s_type_1 is ( ); create type dams_arrytype1 is table of s_type_1; +create procedure comment_test_procedure(int,int) as begin select $1 + $2;end; +/ +comment on function comment_test_procedure(int,int) is 'test_comment_on'; + \! @abs_bindir@/gs_dump dump_type_db -p @portstring@ -f @abs_bindir@/dump_type.tar -F t >/dev/null 2>&1; echo $? drop database if exists restore_type_db; @@ -20,6 +24,9 @@ create database restore_type_db; \! @abs_bindir@/gs_restore -d restore_type_db -p @portstring@ @abs_bindir@/dump_type.tar >/dev/null 2>&1; echo $? +\c restore_type_db +select proname, obj_description(oid, 'pg_proc') AS comment from pg_proc where proname = 'comment_test_procedure'; + drop database if exists dump_mysql; create database dump_mysql dbcompatibility 'B'; \c dump_mysql diff --git a/src/test/regress/output/gs_dump_tableof.source b/src/test/regress/output/gs_dump_tableof.source index eaac8229620011f52de1a939897db636a3eb60f5..6abd32cb320a25ee7fd0694077b98699c07e25fe 100644 --- a/src/test/regress/output/gs_dump_tableof.source +++ b/src/test/regress/output/gs_dump_tableof.source @@ -13,6 +13,9 @@ create type s_type_1 is ( addr text ); create type dams_arrytype1 is table of s_type_1; +create procedure comment_test_procedure(int,int) as begin select $1 + $2;end; +/ +comment on function comment_test_procedure(int,int) is 'test_comment_on'; \! @abs_bindir@/gs_dump dump_type_db -p @portstring@ -f @abs_bindir@/dump_type.tar -F t >/dev/null 2>&1; echo $? 0 drop database if exists restore_type_db; @@ -20,6 +23,13 @@ NOTICE: database "restore_type_db" does not exist, skipping create database restore_type_db; \! @abs_bindir@/gs_restore -d restore_type_db -p @portstring@ @abs_bindir@/dump_type.tar >/dev/null 2>&1; echo $? 0 +\c restore_type_db +select proname, obj_description(oid, 'pg_proc') AS comment from pg_proc where proname = 'comment_test_procedure'; + proname | comment +------------------------+----------------- + comment_test_procedure | test_comment_on +(1 row) + drop database if exists dump_mysql; NOTICE: database "dump_mysql" does not exist, skipping create database dump_mysql dbcompatibility 'B';