mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +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:
@@ -39,7 +39,7 @@ GRANT { { USAGE | SELECT | UPDATE }
|
||||
TO { [ GROUP ] <replaceable class="parameter">role_name</replaceable> | PUBLIC } [, ...] [ WITH GRANT OPTION ]
|
||||
|
||||
GRANT { EXECUTE | ALL [ PRIVILEGES ] }
|
||||
ON FUNCTIONS
|
||||
ON { FUNCTIONS | ROUTINES }
|
||||
TO { [ GROUP ] <replaceable class="parameter">role_name</replaceable> | PUBLIC } [, ...] [ WITH GRANT OPTION ]
|
||||
|
||||
GRANT { USAGE | ALL [ PRIVILEGES ] }
|
||||
@@ -66,7 +66,7 @@ REVOKE [ GRANT OPTION FOR ]
|
||||
|
||||
REVOKE [ GRANT OPTION FOR ]
|
||||
{ EXECUTE | ALL [ PRIVILEGES ] }
|
||||
ON FUNCTIONS
|
||||
ON { FUNCTIONS | ROUTINES }
|
||||
FROM { [ GROUP ] <replaceable class="parameter">role_name</replaceable> | PUBLIC } [, ...]
|
||||
[ CASCADE | RESTRICT ]
|
||||
|
||||
@@ -93,7 +93,13 @@ REVOKE [ GRANT OPTION FOR ]
|
||||
affect privileges assigned to already-existing objects.) Currently,
|
||||
only the privileges for schemas, tables (including views and foreign
|
||||
tables), sequences, functions, and types (including domains) can be
|
||||
altered.
|
||||
altered. For this command, functions include aggregates and procedures.
|
||||
The words <literal>FUNCTIONS</literal> and <literal>ROUTINES</literal> are
|
||||
equivalent in this command. (<literal>ROUTINES</literal> is preferred
|
||||
going forward as the standard term for functions and procedures taken
|
||||
together. In earlier PostgreSQL releases, only the
|
||||
word <literal>FUNCTIONS</literal> was allowed. It is not possible to set
|
||||
default privileges for functions and procedures separately.)
|
||||
</para>
|
||||
|
||||
<para>
|
||||
|
Reference in New Issue
Block a user