1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-05 07:21:24 +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:
Peter Eisentraut
2017-11-30 08:46:13 -05:00
parent 1761653bbb
commit e4128ee767
92 changed files with 2952 additions and 306 deletions

View File

@ -55,9 +55,9 @@ CREATE [ OR REPLACE ] FUNCTION
<para>
If a schema name is included, then the function is created in the
specified schema. Otherwise it is created in the current schema.
The name of the new function must not match any existing function
The name of the new function must not match any existing function or procedure
with the same input argument types in the same schema. However,
functions of different argument types can share a name (this is
functions and procedures of different argument types can share a name (this is
called <firstterm>overloading</firstterm>).
</para>
@ -450,7 +450,7 @@ CREATE [ OR REPLACE ] FUNCTION
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">execution_cost</replaceable></term>
<term><literal>COST</literal> <replaceable class="parameter">execution_cost</replaceable></term>
<listitem>
<para>
@ -466,7 +466,7 @@ CREATE [ OR REPLACE ] FUNCTION
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">result_rows</replaceable></term>
<term><literal>ROWS</literal> <replaceable class="parameter">result_rows</replaceable></term>
<listitem>
<para>
@ -818,7 +818,7 @@ COMMIT;
<title>Compatibility</title>
<para>
A <command>CREATE FUNCTION</command> command is defined in SQL:1999 and later.
A <command>CREATE FUNCTION</command> command is defined in the SQL standard.
The <productname>PostgreSQL</productname> version is similar but
not fully compatible. The attributes are not portable, neither are the
different available languages.