mirror of
https://github.com/postgres/postgres.git
synced 2025-06-13 07:41:39 +03:00
SQL procedures
This adds a new object type "procedure" that is similar to a function but does not have a return type and is invoked by the new CALL statement instead of SELECT or similar. This implementation is aligned with the SQL standard and compatible with or similar to other SQL implementations. This commit adds new commands CALL, CREATE/ALTER/DROP PROCEDURE, as well as ALTER/DROP ROUTINE that can refer to either a function or a procedure (or an aggregate function, as an extension to SQL). There is also support for procedures in various utility commands such as COMMENT and GRANT, as well as support in pg_dump and psql. Support for defining procedures is available in all the languages supplied by the core distribution. While this commit is mainly syntax sugar around existing functionality, future features will rely on having procedures as a separate object type. Reviewed-by: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
This commit is contained in:
@ -480,6 +480,7 @@ transformIndirection(ParseState *pstate, A_Indirection *ind)
|
||||
list_make1(result),
|
||||
last_srf,
|
||||
NULL,
|
||||
false,
|
||||
location);
|
||||
if (newresult == NULL)
|
||||
unknown_attribute(pstate, result, strVal(n), location);
|
||||
@ -629,6 +630,7 @@ transformColumnRef(ParseState *pstate, ColumnRef *cref)
|
||||
list_make1(node),
|
||||
pstate->p_last_srf,
|
||||
NULL,
|
||||
false,
|
||||
cref->location);
|
||||
}
|
||||
break;
|
||||
@ -676,6 +678,7 @@ transformColumnRef(ParseState *pstate, ColumnRef *cref)
|
||||
list_make1(node),
|
||||
pstate->p_last_srf,
|
||||
NULL,
|
||||
false,
|
||||
cref->location);
|
||||
}
|
||||
break;
|
||||
@ -736,6 +739,7 @@ transformColumnRef(ParseState *pstate, ColumnRef *cref)
|
||||
list_make1(node),
|
||||
pstate->p_last_srf,
|
||||
NULL,
|
||||
false,
|
||||
cref->location);
|
||||
}
|
||||
break;
|
||||
@ -1477,6 +1481,7 @@ transformFuncCall(ParseState *pstate, FuncCall *fn)
|
||||
targs,
|
||||
last_srf,
|
||||
fn,
|
||||
false,
|
||||
fn->location);
|
||||
}
|
||||
|
||||
@ -1812,6 +1817,7 @@ transformSubLink(ParseState *pstate, SubLink *sublink)
|
||||
case EXPR_KIND_RETURNING:
|
||||
case EXPR_KIND_VALUES:
|
||||
case EXPR_KIND_VALUES_SINGLE:
|
||||
case EXPR_KIND_CALL:
|
||||
/* okay */
|
||||
break;
|
||||
case EXPR_KIND_CHECK_CONSTRAINT:
|
||||
@ -3462,6 +3468,8 @@ ParseExprKindName(ParseExprKind exprKind)
|
||||
return "WHEN";
|
||||
case EXPR_KIND_PARTITION_EXPRESSION:
|
||||
return "PARTITION BY";
|
||||
case EXPR_KIND_CALL:
|
||||
return "CALL";
|
||||
|
||||
/*
|
||||
* There is intentionally no default: case here, so that the
|
||||
|
Reference in New Issue
Block a user