mirror of
https://github.com/postgres/postgres.git
synced 2025-06-17 17:02:08 +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:
@ -508,6 +508,14 @@ check_agglevels_and_constraints(ParseState *pstate, Node *expr)
|
||||
|
||||
break;
|
||||
|
||||
case EXPR_KIND_CALL:
|
||||
if (isAgg)
|
||||
err = _("aggregate functions are not allowed in CALL arguments");
|
||||
else
|
||||
err = _("grouping operations are not allowed in CALL arguments");
|
||||
|
||||
break;
|
||||
|
||||
/*
|
||||
* There is intentionally no default: case here, so that the
|
||||
* compiler will warn if we add a new ParseExprKind without
|
||||
@ -883,6 +891,9 @@ transformWindowFuncCall(ParseState *pstate, WindowFunc *wfunc,
|
||||
case EXPR_KIND_PARTITION_EXPRESSION:
|
||||
err = _("window functions are not allowed in partition key expression");
|
||||
break;
|
||||
case EXPR_KIND_CALL:
|
||||
err = _("window functions are not allowed in CALL arguments");
|
||||
break;
|
||||
|
||||
/*
|
||||
* There is intentionally no default: case here, so that the
|
||||
|
Reference in New Issue
Block a user