!79 produce: multi options error

Merge pull request !79 from 吴岳川/master
This commit is contained in:
opengauss-bot
2020-08-07 09:32:56 +08:00
committed by Gitee
6 changed files with 59 additions and 2 deletions

View File

@ -9010,7 +9010,31 @@ callfunc_args: func_arg_expr
;
CreateProcedureStmt:
CREATE opt_or_replace PROCEDURE func_name_opt_arg proc_args
opt_createproc_opt_list as_is {u_sess->parser_cxt.eaten_declare = false; u_sess->parser_cxt.eaten_begin = false;} subprogram_body
as_is {u_sess->parser_cxt.eaten_declare = false; u_sess->parser_cxt.eaten_begin = false;} subprogram_body
{
CreateFunctionStmt *n = makeNode(CreateFunctionStmt);
int count = get_outarg_num($5);
n->isOraStyle = true;
n->replace = $2;
n->funcname = $4;
n->parameters = $5;
n->returnType = NULL;
n->isProcedure = true;
if (0 == count)
{
n->returnType = makeTypeName("void");
n->returnType->typmods = NULL;
n->returnType->arrayBounds = NULL;
}
n->options = list_make1(makeDefElem("as",
(Node *)list_make1(makeString($8))));
n->options = lappend(n->options, makeDefElem("language",
(Node *)makeString("plpgsql")));
n->withClause = NIL;
$$ = (Node *)n;
}
| CREATE opt_or_replace PROCEDURE func_name_opt_arg proc_args
createfunc_opt_list as_is {u_sess->parser_cxt.eaten_declare = false; u_sess->parser_cxt.eaten_begin = false;} subprogram_body
{
CreateFunctionStmt *n = makeNode(CreateFunctionStmt);
int count = get_outarg_num($5);

View File

@ -0,0 +1,6 @@
create function create_function_test(integer,integer) RETURNS integer
AS 'SELECT $1 + $2;'
LANGUAGE SQL
IMMUTABLE SHIPPABLE
RETURNS NULL ON NULL INPUT;
drop function create_function_test;

View File

@ -0,0 +1,8 @@
create procedure test_procedure_test(int,int)
SHIPPABLE IMMUTABLE
as
begin
select $1 + $2;
end;
/
drop procedure test_procedure_test;

View File

@ -577,3 +577,8 @@ test: gtt_function
test: gtt_prepare
test: gtt_parallel_1 gtt_parallel_2
test: gtt_clean
# procedure, Function Test
test: create_procedure
test: create_function

View File

@ -0,0 +1,6 @@
create function create_function_test(integer,integer) RETURNS integer
AS 'SELECT $1 + $2;'
LANGUAGE SQL
IMMUTABLE SHIPPABLE
RETURNS NULL ON NULL INPUT;
drop function create_function_test;

View File

@ -0,0 +1,8 @@
create procedure test_procedure_test(int,int)
SHIPPABLE IMMUTABLE
as
begin
select $1 + $2;
end;
/
drop procedure test_procedure_test;