1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Doc: improve introductory information about procedures.

Clarify the discussion in "User-Defined Procedures", by laying out
the key differences between functions and procedures in a bulleted
list.  Notably, this avoids burying the lede about procedures being
able to do transaction control.  Make the back-link in the CREATE
FUNCTION reference page more prominent, and add one in CREATE
PROCEDURE.

Per gripe from Guyren Howe.  Thanks to David Johnston for discussion.

Discussion: https://postgr.es/m/BYAPR03MB4903C53A8BB7EFF5EA289674A6949@BYAPR03MB4903.namprd03.prod.outlook.com
This commit is contained in:
Tom Lane
2021-03-10 11:33:50 -05:00
parent fe2b5386b2
commit 9a4e4af420
3 changed files with 55 additions and 20 deletions

View File

@ -100,6 +100,11 @@ CREATE [ OR REPLACE ] FUNCTION
To be able to create a function, you must have <literal>USAGE</literal>
privilege on the argument types and the return type.
</para>
<para>
Refer to <xref linkend="xfunc"/> for further information on writing
functions.
</para>
</refsect1>
<refsect1>
@ -578,12 +583,6 @@ CREATE [ OR REPLACE ] FUNCTION
</varlistentry>
</variablelist>
<para>
Refer to <xref linkend="xfunc"/> for further information on writing
functions.
</para>
</refsect1>
<refsect1 id="sql-createfunction-overloading">
@ -661,8 +660,7 @@ CREATE FUNCTION foo(int, int default 42) ...
<title>Examples</title>
<para>
Here are some trivial examples to help you get started. For more
information and examples, see <xref linkend="xfunc"/>.
Add two integers using a SQL function:
<programlisting>
CREATE FUNCTION add(integer, integer) RETURNS integer
AS 'select $1 + $2;'