Commit b1949577 authored by Peter Eisentraut's avatar Peter Eisentraut

doc: Update uses of the word "procedure"

Historically, the term procedure was used as a synonym for function in
Postgres/PostgreSQL.  Now we have procedures as separate objects from
functions, so we need to clean up the documentation to not mix those
terms.

In particular, mentions of "trigger procedures" are changed to "trigger
functions", and access method "support procedures" are changed to
"support functions".  (The latter already used FUNCTION in the SQL
syntax anyway.)  Also, the terminology in the SPI chapter has been
cleaned up.

A few tests, examples, and code comments are also adjusted to be
consistent with documentation changes, but not everything.
Reported-by: default avatarPeter Geoghegan <pg@bowt.ie>
Reviewed-by: default avatarJonathan S. Katz <jonathan.katz@excoventures.com>
parent af63926c
......@@ -537,7 +537,7 @@ typedef struct BrinOpcInfo
} BrinOpcInfo;
</programlisting>
<structname>BrinOpcInfo</structname>.<structfield>oi_opaque</structfield> can be used by the
operator class routines to pass information between support procedures
operator class routines to pass information between support functions
during an index scan.
</para>
</listitem>
......@@ -587,27 +587,27 @@ typedef struct BrinOpcInfo
defined by the user for other data types using equivalent definitions,
without having to write any source code; appropriate catalog entries being
declared is enough. Note that assumptions about the semantics of operator
strategies are embedded in the support procedures' source code.
strategies are embedded in the support functions' source code.
</para>
<para>
Operator classes that implement completely different semantics are also
possible, provided implementations of the four main support procedures
possible, provided implementations of the four main support functions
described above are written. Note that backwards compatibility across major
releases is not guaranteed: for example, additional support procedures might
releases is not guaranteed: for example, additional support functions might
be required in later releases.
</para>
<para>
To write an operator class for a data type that implements a totally
ordered set, it is possible to use the minmax support procedures
ordered set, it is possible to use the minmax support functions
alongside the corresponding operators, as shown in
<xref linkend="brin-extensibility-minmax-table"/>.
All operator class members (procedures and operators) are mandatory.
All operator class members (functions and operators) are mandatory.
</para>
<table id="brin-extensibility-minmax-table">
<title>Procedure and Support Numbers for Minmax Operator Classes</title>
<title>Function and Support Numbers for Minmax Operator Classes</title>
<tgroup cols="2">
<thead>
<row>
......@@ -617,19 +617,19 @@ typedef struct BrinOpcInfo
</thead>
<tbody>
<row>
<entry>Support Procedure 1</entry>
<entry>Support Function 1</entry>
<entry>internal function <function>brin_minmax_opcinfo()</function></entry>
</row>
<row>
<entry>Support Procedure 2</entry>
<entry>Support Function 2</entry>
<entry>internal function <function>brin_minmax_add_value()</function></entry>
</row>
<row>
<entry>Support Procedure 3</entry>
<entry>Support Function 3</entry>
<entry>internal function <function>brin_minmax_consistent()</function></entry>
</row>
<row>
<entry>Support Procedure 4</entry>
<entry>Support Function 4</entry>
<entry>internal function <function>brin_minmax_union()</function></entry>
</row>
<row>
......@@ -659,7 +659,7 @@ typedef struct BrinOpcInfo
<para>
To write an operator class for a complex data type which has values
included within another type, it's possible to use the inclusion support
procedures alongside the corresponding operators, as shown
functions alongside the corresponding operators, as shown
in <xref linkend="brin-extensibility-inclusion-table"/>. It requires
only a single additional function, which can be written in any language.
More functions can be defined for additional functionality. All operators
......@@ -668,7 +668,7 @@ typedef struct BrinOpcInfo
</para>
<table id="brin-extensibility-inclusion-table">
<title>Procedure and Support Numbers for Inclusion Operator Classes</title>
<title>Function and Support Numbers for Inclusion Operator Classes</title>
<tgroup cols="3">
<thead>
<row>
......@@ -679,42 +679,42 @@ typedef struct BrinOpcInfo
</thead>
<tbody>
<row>
<entry>Support Procedure 1</entry>
<entry>Support Function 1</entry>
<entry>internal function <function>brin_inclusion_opcinfo()</function></entry>
<entry></entry>
</row>
<row>
<entry>Support Procedure 2</entry>
<entry>Support Function 2</entry>
<entry>internal function <function>brin_inclusion_add_value()</function></entry>
<entry></entry>
</row>
<row>
<entry>Support Procedure 3</entry>
<entry>Support Function 3</entry>
<entry>internal function <function>brin_inclusion_consistent()</function></entry>
<entry></entry>
</row>
<row>
<entry>Support Procedure 4</entry>
<entry>Support Function 4</entry>
<entry>internal function <function>brin_inclusion_union()</function></entry>
<entry></entry>
</row>
<row>
<entry>Support Procedure 11</entry>
<entry>Support Function 11</entry>
<entry>function to merge two elements</entry>
<entry></entry>
</row>
<row>
<entry>Support Procedure 12</entry>
<entry>Support Function 12</entry>
<entry>optional function to check whether two elements are mergeable</entry>
<entry></entry>
</row>
<row>
<entry>Support Procedure 13</entry>
<entry>Support Function 13</entry>
<entry>optional function to check if an element is contained within another</entry>
<entry></entry>
</row>
<row>
<entry>Support Procedure 14</entry>
<entry>Support Function 14</entry>
<entry>optional function to check whether an element is empty</entry>
<entry></entry>
</row>
......@@ -803,7 +803,7 @@ typedef struct BrinOpcInfo
</table>
<para>
Support procedure numbers 1-10 are reserved for the BRIN internal
Support function numbers 1-10 are reserved for the BRIN internal
functions, so the SQL level functions start with number 11. Support
function number 11 is the main function required to build the index.
It should accept two arguments with the same data type as the operator class,
......@@ -814,11 +814,11 @@ typedef struct BrinOpcInfo
</para>
<para>
Support procedure numbers 12 and 14 are provided to support
irregularities of built-in data types. Procedure number 12
Support function numbers 12 and 14 are provided to support
irregularities of built-in data types. Function number 12
is used to support network addresses from different families which
are not mergeable. Procedure number 14 is used to support
empty ranges. Procedure number 13 is an optional but
are not mergeable. Function number 14 is used to support
empty ranges. Function number 13 is an optional but
recommended one, which allows the new value to be checked before
it is passed to the union function. As the BRIN framework can shortcut
some operations when the union is not changed, using this
......
......@@ -67,7 +67,7 @@
<row>
<entry><link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link></entry>
<entry>access method support procedures</entry>
<entry>access method support functions</entry>
</row>
<row>
......@@ -814,8 +814,8 @@
<para>
The catalog <structname>pg_amproc</structname> stores information about
support procedures associated with access method operator families. There
is one row for each support procedure belonging to an operator family.
support functions associated with access method operator families. There
is one row for each support function belonging to an operator family.
</para>
<table>
......@@ -864,14 +864,14 @@
<entry><structfield>amprocnum</structfield></entry>
<entry><type>int2</type></entry>
<entry></entry>
<entry>Support procedure number</entry>
<entry>Support function number</entry>
</row>
<row>
<entry><structfield>amproc</structfield></entry>
<entry><type>regproc</type></entry>
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
<entry>OID of the procedure</entry>
<entry>OID of the function</entry>
</row>
</tbody>
......@@ -882,9 +882,9 @@
The usual interpretation of the
<structfield>amproclefttype</structfield> and <structfield>amprocrighttype</structfield> fields
is that they identify the left and right input types of the operator(s)
that a particular support procedure supports. For some access methods
these match the input data type(s) of the support procedure itself, for
others not. There is a notion of <quote>default</quote> support procedures for
that a particular support function supports. For some access methods
these match the input data type(s) of the support function itself, for
others not. There is a notion of <quote>default</quote> support functions for
an index, which are those with <structfield>amproclefttype</structfield> and
<structfield>amprocrighttype</structfield> both equal to the index operator class's
<structfield>opcintype</structfield>.
......@@ -2471,7 +2471,7 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
<para>
The catalog <structname>pg_conversion</structname> describes
encoding conversion procedures. See <xref linkend="sql-createconversion"/>
encoding conversion functions. See <xref linkend="sql-createconversion"/>
for more information.
</para>
......@@ -2537,7 +2537,7 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
<entry><structfield>conproc</structfield></entry>
<entry><type>regproc</type></entry>
<entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry>
<entry>Conversion procedure</entry>
<entry>Conversion function</entry>
</row>
<row>
......
......@@ -1053,8 +1053,8 @@ CREATE EVENT TRIGGER noddl ON ddl_command_start
<screen>
=# \dy
List of event triggers
Name | Event | Owner | Enabled | Procedure | Tags
-------+-------------------+-------+---------+-----------+------
Name | Event | Owner | Enabled | Function | Tags
-------+-------------------+-------+---------+----------+------
noddl | ddl_command_start | dim | enabled | noddl |
(1 row)
......
......@@ -12360,7 +12360,7 @@ SELECT setval('foo', 42, false); <lineannotation>Next <function>nextval</func
<tip>
<para>
If your needs go beyond the capabilities of these conditional
expressions, you might want to consider writing a stored procedure
expressions, you might want to consider writing a server-side function
in a more expressive programming language.
</para>
</tip>
......
......@@ -119,7 +119,7 @@ plsample_call_handler(PG_FUNCTION_ARGS)
if (CALLED_AS_TRIGGER(fcinfo))
{
/*
* Called as a trigger procedure
* Called as a trigger function
*/
TriggerData *trigdata = (TriggerData *) fcinfo-&gt;context;
......
......@@ -1337,7 +1337,7 @@ CREATE TRIGGER test_valid_id_trig
</para>
<para>
The return value of the trigger procedure is ignored.
The return value of the trigger function is ignored.
</para>
<para>
......
......@@ -19,7 +19,7 @@
<itemizedlist>
<listitem>
<para>
can be used to create functions and trigger procedures,
can be used to create functions and triggers,
</para>
</listitem>
<listitem>
......@@ -305,7 +305,7 @@ $$ LANGUAGE plpgsql;
for transaction
control. <application>PL/pgSQL</application>'s <command>BEGIN</command>/<command>END</command>
are only for grouping; they do not start or end a transaction.
Functions and trigger procedures are always executed within a transaction
Functions are always executed within a transaction
established by an outer query &mdash; they cannot start or commit that
transaction, since there would be no context for them to execute in.
However, a block containing an <literal>EXCEPTION</literal> clause effectively
......@@ -579,7 +579,7 @@ $$ LANGUAGE plpgsql;
function parameters. The main practical use for this is to assign
a different name for variables with predetermined names, such as
<varname>NEW</varname> or <varname>OLD</varname> within
a trigger procedure.
a trigger function.
</para>
<para>
......@@ -3796,7 +3796,7 @@ ASSERT <replaceable class="parameter">condition</replaceable> <optional> , <repl
</sect1>
<sect1 id="plpgsql-trigger">
<title>Trigger Procedures</title>
<title>Trigger Functions</title>
<indexterm zone="plpgsql-trigger">
<primary>trigger</primary>
......@@ -3805,8 +3805,8 @@ ASSERT <replaceable class="parameter">condition</replaceable> <optional> , <repl
<para>
<application>PL/pgSQL</application> can be used to define trigger
procedures on data changes or database events.
A trigger procedure is created with the <command>CREATE FUNCTION</command>
functions on data changes or database events.
A trigger function is created with the <command>CREATE FUNCTION</command>
command, declaring it as a function with no arguments and a return type of
<type>trigger</type> (for data change triggers) or
<type>event_trigger</type> (for database event triggers).
......@@ -3946,7 +3946,7 @@ ASSERT <replaceable class="parameter">condition</replaceable> <optional> , <repl
<listitem>
<para>
Data type <type>integer</type>; the number of arguments given to the trigger
procedure in the <command>CREATE TRIGGER</command> statement.
function in the <command>CREATE TRIGGER</command> statement.
</para>
</listitem>
</varlistentry>
......@@ -4025,11 +4025,11 @@ ASSERT <replaceable class="parameter">condition</replaceable> <optional> , <repl
<para>
<xref linkend="plpgsql-trigger-example"/> shows an example of a
trigger procedure in <application>PL/pgSQL</application>.
trigger function in <application>PL/pgSQL</application>.
</para>
<example id="plpgsql-trigger-example">
<title>A <application>PL/pgSQL</application> Trigger Procedure</title>
<title>A <application>PL/pgSQL</application> Trigger Function</title>
<para>
This example trigger ensures that any time a row is inserted or updated
......@@ -4078,11 +4078,11 @@ CREATE TRIGGER emp_stamp BEFORE INSERT OR UPDATE ON emp
holds a row for each insert, update, or delete that occurs. This approach
can be thought of as auditing changes to a table.
<xref linkend="plpgsql-trigger-audit-example"/> shows an example of an
audit trigger procedure in <application>PL/pgSQL</application>.
audit trigger function in <application>PL/pgSQL</application>.
</para>
<example id="plpgsql-trigger-audit-example">
<title>A <application>PL/pgSQL</application> Trigger Procedure For Auditing</title>
<title>A <application>PL/pgSQL</application> Trigger Function For Auditing</title>
<para>
This example trigger ensures that any insert, update or delete of a row
......@@ -4139,7 +4139,7 @@ AFTER INSERT OR UPDATE OR DELETE ON emp
</para>
<example id="plpgsql-view-trigger-audit-example">
<title>A <application>PL/pgSQL</application> View Trigger Procedure For Auditing</title>
<title>A <application>PL/pgSQL</application> View Trigger Function For Auditing</title>
<para>
This example uses a trigger on the view to make it updatable, and
......@@ -4215,13 +4215,13 @@ INSTEAD OF INSERT OR UPDATE OR DELETE ON emp_view
This technique is commonly used in Data Warehousing, where the tables
of measured or observed data (called fact tables) might be extremely large.
<xref linkend="plpgsql-trigger-summary-example"/> shows an example of a
trigger procedure in <application>PL/pgSQL</application> that maintains
trigger function in <application>PL/pgSQL</application> that maintains
a summary table for a fact table in a data warehouse.
</para>
<example id="plpgsql-trigger-summary-example">
<title>A <application>PL/pgSQL</application> Trigger Procedure For Maintaining A Summary Table</title>
<title>A <application>PL/pgSQL</application> Trigger Function For Maintaining A Summary Table</title>
<para>
The schema detailed here is partly based on the <emphasis>Grocery Store
......@@ -4445,7 +4445,7 @@ CREATE TRIGGER emp_audit_del
<para>
<application>PL/pgSQL</application> can be used to define
<link linkend="event-triggers">event triggers</link>.
<productname>PostgreSQL</productname> requires that a procedure that
<productname>PostgreSQL</productname> requires that a function that
is to be called as an event trigger must be declared as a function with
no arguments and a return type of <literal>event_trigger</literal>.
</para>
......@@ -4480,11 +4480,11 @@ CREATE TRIGGER emp_audit_del
<para>
<xref linkend="plpgsql-event-trigger-example"/> shows an example of an
event trigger procedure in <application>PL/pgSQL</application>.
event trigger function in <application>PL/pgSQL</application>.
</para>
<example id="plpgsql-event-trigger-example">
<title>A <application>PL/pgSQL</application> Event Trigger Procedure</title>
<title>A <application>PL/pgSQL</application> Event Trigger Function</title>
<para>
This example trigger simply raises a <literal>NOTICE</literal> message
......
......@@ -15,8 +15,8 @@
PL/Tcl is a loadable procedural language for the
<productname>PostgreSQL</productname> database system
that enables the <ulink url="http://www.tcl.tk/">
Tcl language</ulink> to be used to write functions and
trigger procedures.
Tcl language</ulink> to be used to write
<productname>PostgreSQL</productname> functions.
</para>
<!-- **** PL/Tcl overview **** -->
......@@ -587,7 +587,7 @@ SELECT 'doesn''t' AS ret
</sect1>
<sect1 id="pltcl-trigger">
<title>Trigger Procedures in PL/Tcl</title>
<title>Trigger Functions in PL/Tcl</title>
<indexterm>
<primary>trigger</primary>
......@@ -595,13 +595,13 @@ SELECT 'doesn''t' AS ret
</indexterm>
<para>
Trigger procedures can be written in PL/Tcl.
<productname>PostgreSQL</productname> requires that a procedure that is to be called
Trigger functions can be written in PL/Tcl.
<productname>PostgreSQL</productname> requires that a function that is to be called
as a trigger must be declared as a function with no arguments
and a return type of <literal>trigger</literal>.
</para>
<para>
The information from the trigger manager is passed to the procedure body
The information from the trigger manager is passed to the function body
in the following variables:
<variablelist>
......@@ -619,7 +619,7 @@ SELECT 'doesn''t' AS ret
<term><varname>$TG_relid</varname></term>
<listitem>
<para>
The object ID of the table that caused the trigger procedure
The object ID of the table that caused the trigger function
to be invoked.
</para>
</listitem>
......@@ -629,7 +629,7 @@ SELECT 'doesn''t' AS ret
<term><varname>$TG_table_name</varname></term>
<listitem>
<para>
The name of the table that caused the trigger procedure
The name of the table that caused the trigger function
to be invoked.
</para>
</listitem>
......@@ -639,7 +639,7 @@ SELECT 'doesn''t' AS ret
<term><varname>$TG_table_schema</varname></term>
<listitem>
<para>
The schema of the table that caused the trigger procedure
The schema of the table that caused the trigger function
to be invoked.
</para>
</listitem>
......@@ -722,9 +722,9 @@ SELECT 'doesn''t' AS ret
<term><varname>$args</varname></term>
<listitem>
<para>
A Tcl list of the arguments to the procedure as given in the
A Tcl list of the arguments to the function as given in the
<command>CREATE TRIGGER</command> statement. These arguments are also accessible as
<literal>$1</literal> ... <literal>$<replaceable>n</replaceable></literal> in the procedure body.
<literal>$1</literal> ... <literal>$<replaceable>n</replaceable></literal> in the function body.
</para>
</listitem>
</varlistentry>
......@@ -733,7 +733,7 @@ SELECT 'doesn''t' AS ret
</para>
<para>
The return value from a trigger procedure can be one of the strings
The return value from a trigger function can be one of the strings
<literal>OK</literal> or <literal>SKIP</literal>, or a list of column name/value pairs.
If the return value is <literal>OK</literal>,
the operation (<command>INSERT</command>/<command>UPDATE</command>/<command>DELETE</command>)
......@@ -764,7 +764,7 @@ SELECT 'doesn''t' AS ret
</tip>
<para>
Here's a little example trigger procedure that forces an integer value
Here's a little example trigger function that forces an integer value
in a table to keep track of the number of updates that are performed on the
row. For new rows inserted, the value is initialized to 0 and then
incremented on every update operation.
......@@ -792,14 +792,14 @@ CREATE TRIGGER trig_mytab_modcount BEFORE INSERT OR UPDATE ON mytab
FOR EACH ROW EXECUTE PROCEDURE trigfunc_modcount('modcnt');
</programlisting>
Notice that the trigger procedure itself does not know the column
Notice that the trigger function itself does not know the column
name; that's supplied from the trigger arguments. This lets the
trigger procedure be reused with different tables.
trigger function be reused with different tables.
</para>
</sect1>
<sect1 id="pltcl-event-trigger">
<title>Event Trigger Procedures in PL/Tcl</title>
<title>Event Trigger Functions in PL/Tcl</title>
<indexterm>
<primary>event trigger</primary>
......@@ -807,13 +807,13 @@ CREATE TRIGGER trig_mytab_modcount BEFORE INSERT OR UPDATE ON mytab
</indexterm>
<para>
Event trigger procedures can be written in PL/Tcl.
<productname>PostgreSQL</productname> requires that a procedure that is
Event trigger functions can be written in PL/Tcl.
<productname>PostgreSQL</productname> requires that a function that is
to be called as an event trigger must be declared as a function with no
arguments and a return type of <literal>event_trigger</literal>.
</para>
<para>
The information from the trigger manager is passed to the procedure body
The information from the trigger manager is passed to the function body
in the following variables:
<variablelist>
......@@ -839,11 +839,11 @@ CREATE TRIGGER trig_mytab_modcount BEFORE INSERT OR UPDATE ON mytab
</para>
<para>
The return value of the trigger procedure is ignored.
The return value of the trigger function is ignored.
</para>
<para>
Here's a little example event trigger procedure that simply raises
Here's a little example event trigger function that simply raises
a <literal>NOTICE</literal> message each time a supported command is
executed:
......
......@@ -185,7 +185,7 @@ ALTER OPERATOR FAMILY <replaceable>name</replaceable> USING <replaceable class="
<term><replaceable class="parameter">support_number</replaceable></term>
<listitem>
<para>
The index method's support procedure number for a
The index method's support function number for a
function associated with the operator family.
</para>
</listitem>
......@@ -196,7 +196,7 @@ ALTER OPERATOR FAMILY <replaceable>name</replaceable> USING <replaceable class="
<listitem>
<para>
The name (optionally schema-qualified) of a function that is an index
method support procedure for the operator family. If no argument list
method support function for the operator family. If no argument list
is specified, the name must be unique in its schema.
</para>
</listitem>
......
......@@ -33,7 +33,7 @@ CREATE [ OR REPLACE ] [ TRUSTED ] [ PROCEDURAL ] LANGUAGE <replaceable class="pa
<para>
<command>CREATE LANGUAGE</command> registers a new
procedural language with a <productname>PostgreSQL</productname>
database. Subsequently, functions and trigger procedures can be
database. Subsequently, functions and procedures can be
defined in this new language.
</para>
......
......@@ -38,7 +38,7 @@ CREATE OPERATOR CLASS <replaceable class="parameter">name</replaceable> [ DEFAUL
An operator class defines how a particular data type can be used with
an index. The operator class specifies that certain operators will fill
particular roles or <quote>strategies</quote> for this data type and this
index method. The operator class also specifies the support procedures to
index method. The operator class also specifies the support functions to
be used by
the index method when the operator class is selected for an
index column. All the operators and functions used by an operator
......@@ -201,7 +201,7 @@ CREATE OPERATOR CLASS <replaceable class="parameter">name</replaceable> [ DEFAUL
<term><replaceable class="parameter">support_number</replaceable></term>
<listitem>
<para>
The index method's support procedure number for a
The index method's support function number for a
function associated with the operator class.
</para>
</listitem>
......@@ -212,7 +212,7 @@ CREATE OPERATOR CLASS <replaceable class="parameter">name</replaceable> [ DEFAUL
<listitem>
<para>
The name (optionally schema-qualified) of a function that is an
index method support procedure for the operator class.
index method support function for the operator class.
</para>
</listitem>
</varlistentry>
......
......@@ -94,7 +94,7 @@ CREATE OPERATOR <replaceable>name</replaceable> (
<para>
The <replaceable class="parameter">function_name</replaceable>
procedure must have been previously defined using <command>CREATE
function must have been previously defined using <command>CREATE
FUNCTION</command> and must be defined to accept the correct number
of arguments (either one or two) of the indicated types.
</para>
......@@ -264,11 +264,11 @@ COMMUTATOR = OPERATOR(myschema.===) ,
CREATE OPERATOR === (
LEFTARG = box,
RIGHTARG = box,
PROCEDURE = area_equal_procedure,
PROCEDURE = area_equal_function,
COMMUTATOR = ===,
NEGATOR = !==,
RESTRICT = area_restriction_procedure,
JOIN = area_join_procedure,
RESTRICT = area_restriction_function,
JOIN = area_join_function,
HASHES, MERGES
);
</programlisting></para>
......
......@@ -348,7 +348,7 @@ UPDATE OF <replaceable>column_name1</replaceable> [, <replaceable>column_name2</
<listitem>
<para>
This specifies whether the trigger procedure should be fired
This specifies whether the trigger function should be fired
once for every row affected by the trigger event, or just once
per SQL statement. If neither is specified, <literal>FOR EACH
STATEMENT</literal> is the default. Constraint triggers can only
......
This diff is collapsed.
......@@ -50,7 +50,7 @@
<literal>WHERE</literal>-clause operators that can be used with an index
(i.e., can be converted into an index-scan qualification). An
operator class can also specify some <firstterm>support
procedures</firstterm> that are needed by the internal operations of the
function</firstterm> that are needed by the internal operations of the
index method, but do not directly correspond to any
<literal>WHERE</literal>-clause operator that can be used with the index.
</para>
......
......@@ -146,7 +146,7 @@ CREATE <optional>TRUSTED</optional> <optional>PROCEDURAL</optional> LANGUAGE <re
the language does not grant access to data that the user would
not otherwise have. Trusted languages are designed for ordinary
database users (those without superuser privilege) and allows them
to safely create functions and trigger
to safely create functions and
procedures. Since PL functions are executed inside the database
server, the <literal>TRUSTED</literal> flag should only be given
for languages that do not allow access to database server
......@@ -206,7 +206,7 @@ CREATE TRUSTED PROCEDURAL LANGUAGE plperl
VALIDATOR plperl_validator;
</programlisting>
then defines that the previously declared functions
should be invoked for functions and trigger procedures where the
should be invoked for functions and procedures where the
language attribute is <literal>plperl</literal>.
</para>
</example>
......
......@@ -90,7 +90,7 @@ ginvalidate(Oid opclassoid)
{
ereport(INFO,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("operator family \"%s\" of access method %s contains support procedure %s with different left and right input types",
errmsg("operator family \"%s\" of access method %s contains support function %s with different left and right input types",
opfamilyname, "gin",
format_procedure(procform->amproc))));
result = false;
......
......@@ -90,7 +90,7 @@ gistvalidate(Oid opclassoid)
{
ereport(INFO,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("operator family \"%s\" of access method %s contains support procedure %s with different left and right input types",
errmsg("operator family \"%s\" of access method %s contains support function %s with different left and right input types",
opfamilyname, "gist",
format_procedure(procform->amproc))));
result = false;
......
......@@ -73,10 +73,10 @@ _hash_checkqual(IndexScanDesc scan, IndexTuple itup)
}
/*
* _hash_datum2hashkey -- given a Datum, call the index's hash procedure
* _hash_datum2hashkey -- given a Datum, call the index's hash function
*
* The Datum is assumed to be of the index's column type, so we can use the
* "primary" hash procedure that's tracked for us by the generic index code.
* "primary" hash function that's tracked for us by the generic index code.
*/
uint32
_hash_datum2hashkey(Relation rel, Datum key)
......
......@@ -96,7 +96,7 @@ hashvalidate(Oid opclassoid)
{
ereport(INFO,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("operator family \"%s\" of access method %s contains support procedure %s with different left and right input types",
errmsg("operator family \"%s\" of access method %s contains support function %s with different left and right input types",
opfamilyname, "hash",
format_procedure(procform->amproc))));
result = false;
......@@ -182,7 +182,7 @@ hashvalidate(Oid opclassoid)
result = false;
}
/* There should be relevant hash procedures for each datatype */
/* There should be relevant hash functions for each datatype */
if (!list_member_oid(hashabletypes, oprform->amoplefttype) ||
!list_member_oid(hashabletypes, oprform->amoprighttype))
{
......
......@@ -96,7 +96,7 @@ spgvalidate(Oid opclassoid)
{
ereport(INFO,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("operator family \"%s\" of access method %s contains support procedure %s with different left and right input types",
errmsg("operator family \"%s\" of access method %s contains support function %s with different left and right input types",
opfamilyname, "spgist",
format_procedure(procform->amproc))));
result = false;
......
......@@ -517,7 +517,7 @@ DefineOpClass(CreateOpClassStmt *stmt)
if (item->number <= 0 || item->number > maxProcNumber)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("invalid procedure number %d,"
errmsg("invalid function number %d,"
" must be between 1 and %d",
item->number, maxProcNumber)));
funcOid = LookupFuncWithArgs(OBJECT_FUNCTION, item->name, false);
......@@ -891,7 +891,7 @@ AlterOpFamilyAdd(AlterOpFamilyStmt *stmt, Oid amoid, Oid opfamilyoid,
if (item->number <= 0 || item->number > maxProcNumber)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("invalid procedure number %d,"
errmsg("invalid function number %d,"
" must be between 1 and %d",
item->number, maxProcNumber)));
funcOid = LookupFuncWithArgs(OBJECT_FUNCTION, item->name, false);
......@@ -986,7 +986,7 @@ AlterOpFamilyDrop(AlterOpFamilyStmt *stmt, Oid amoid, Oid opfamilyoid,
if (item->number <= 0 || item->number > maxProcNumber)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("invalid procedure number %d,"
errmsg("invalid function number %d,"
" must be between 1 and %d",
item->number, maxProcNumber)));
processTypesSpec(item->class_args, &lefttype, &righttype);
......@@ -1141,11 +1141,11 @@ assignProcTypes(OpFamilyMember *member, Oid amoid, Oid typeoid)
if (procform->pronargs != 2)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("btree comparison procedures must have two arguments")));
errmsg("btree comparison functions must have two arguments")));
if (procform->prorettype != INT4OID)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("btree comparison procedures must return integer")));
errmsg("btree comparison functions must return integer")));
/*
* If lefttype/righttype isn't specified, use the proc's input
......@@ -1162,11 +1162,11 @@ assignProcTypes(OpFamilyMember *member, Oid amoid, Oid typeoid)
procform->proargtypes.values[0] != INTERNALOID)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("btree sort support procedures must accept type \"internal\"")));
errmsg("btree sort support functions must accept type \"internal\"")));
if (procform->prorettype != VOIDOID)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("btree sort support procedures must return void")));
errmsg("btree sort support functions must return void")));
/*
* Can't infer lefttype/righttype from proc, so use default rule
......@@ -1177,11 +1177,11 @@ assignProcTypes(OpFamilyMember *member, Oid amoid, Oid typeoid)
if (procform->pronargs != 5)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("btree in_range procedures must have five arguments")));
errmsg("btree in_range functions must have five arguments")));
if (procform->prorettype != BOOLOID)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("btree in_range procedures must return boolean")));
errmsg("btree in_range functions must return boolean")));
/*
* If lefttype/righttype isn't specified, use the proc's input
......@@ -1200,22 +1200,22 @@ assignProcTypes(OpFamilyMember *member, Oid amoid, Oid typeoid)
if (procform->pronargs != 1)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("hash procedure 1 must have one argument")));
errmsg("hash function 1 must have one argument")));
if (procform->prorettype != INT4OID)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("hash procedure 1 must return integer")));
errmsg("hash function 1 must return integer")));
}
else if (member->number == HASHEXTENDED_PROC)
{
if (procform->pronargs != 2)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("hash procedure 2 must have two arguments")));
errmsg("hash function 2 must have two arguments")));
if (procform->prorettype != INT8OID)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("hash procedure 2 must return bigint")));
errmsg("hash function 2 must return bigint")));
}
/*
......@@ -1240,7 +1240,7 @@ assignProcTypes(OpFamilyMember *member, Oid amoid, Oid typeoid)
if (!OidIsValid(member->lefttype) || !OidIsValid(member->righttype))
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("associated data types must be specified for index support procedure")));
errmsg("associated data types must be specified for index support function")));
ReleaseSysCache(proctup);
}
......@@ -1265,7 +1265,7 @@ addFamilyMember(List **list, OpFamilyMember *member, bool isProc)
if (isProc)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("procedure number %d for (%s,%s) appears more than once",
errmsg("function number %d for (%s,%s) appears more than once",
member->number,
format_type_be(member->lefttype),
format_type_be(member->righttype))));
......
......@@ -3907,7 +3907,7 @@ listEventTriggers(const char *pattern, bool verbose)
gettext_noop("always"),
gettext_noop("disabled"),
gettext_noop("Enabled"),
gettext_noop("Procedure"),
gettext_noop("Function"),
gettext_noop("Tags"));
if (verbose)
appendPQExpBuffer(&buf,
......
......@@ -263,7 +263,7 @@ typedef struct HashMetaPageData
* allocated */
uint32 hashm_firstfree; /* lowest-number free ovflpage (bit#) */
uint32 hashm_nmaps; /* number of bitmap pages */
RegProcedure hashm_procid; /* hash procedure id from pg_proc */
RegProcedure hashm_procid; /* hash function id from pg_proc */
uint32 hashm_spares[HASH_MAX_SPLITPOINTS]; /* spare pages before each
* splitpoint */
BlockNumber hashm_mapp[HASH_MAX_BITMAPS]; /* blknos of ovfl bitmaps */
......@@ -338,15 +338,15 @@ typedef HashMetaPageData *HashMetaPage;
/*
* When a new operator class is declared, we require that the user supply
* us with an amproc procedure for hashing a key of the new type, returning
* a 32-bit hash value. We call this the "standard" hash procedure. We
* also allow an optional "extended" hash procedure which accepts a salt and
* us with an amproc function for hashing a key of the new type, returning
* a 32-bit hash value. We call this the "standard" hash function. We
* also allow an optional "extended" hash function which accepts a salt and
* returns a 64-bit hash value. This is highly recommended but, for reasons
* of backward compatibility, optional.
*
* When the salt is 0, the low 32 bits of the value returned by the extended
* hash procedure should match the value that would have been returned by the
* standard hash procedure.
* hash function should match the value that would have been returned by the
* standard hash function.
*/
#define HASHSTANDARD_PROC 1
#define HASHEXTENDED_PROC 2
......
......@@ -354,9 +354,9 @@ ERROR: invalid operator number 0, must be between 1 and 5
ALTER OPERATOR FAMILY alt_opf4 USING btree ADD OPERATOR 1 < ; -- operator without argument types
ERROR: operator argument types must be specified in ALTER OPERATOR FAMILY
ALTER OPERATOR FAMILY alt_opf4 USING btree ADD FUNCTION 0 btint42cmp(int4, int2); -- function number should be between 1 and 5
ERROR: invalid procedure number 0, must be between 1 and 3
ERROR: invalid function number 0, must be between 1 and 3
ALTER OPERATOR FAMILY alt_opf4 USING btree ADD FUNCTION 6 btint42cmp(int4, int2); -- function number should be between 1 and 5
ERROR: invalid procedure number 6, must be between 1 and 3
ERROR: invalid function number 6, must be between 1 and 3
ALTER OPERATOR FAMILY alt_opf4 USING btree ADD STORAGE invalid_storage; -- Ensure STORAGE is not a part of ALTER OPERATOR FAMILY
ERROR: STORAGE cannot be specified in ALTER OPERATOR FAMILY
DROP OPERATOR FAMILY alt_opf4 USING btree;
......@@ -412,7 +412,7 @@ BEGIN TRANSACTION;
CREATE OPERATOR FAMILY alt_opf12 USING btree;
CREATE FUNCTION fn_opf12 (int4, int2) RETURNS BIGINT AS 'SELECT NULL::BIGINT;' LANGUAGE SQL;
ALTER OPERATOR FAMILY alt_opf12 USING btree ADD FUNCTION 1 fn_opf12(int4, int2);
ERROR: btree comparison procedures must return integer
ERROR: btree comparison functions must return integer
DROP OPERATOR FAMILY alt_opf12 USING btree;
ERROR: current transaction is aborted, commands ignored until end of transaction block
ROLLBACK;
......@@ -421,7 +421,7 @@ BEGIN TRANSACTION;
CREATE OPERATOR FAMILY alt_opf13 USING hash;
CREATE FUNCTION fn_opf13 (int4) RETURNS BIGINT AS 'SELECT NULL::BIGINT;' LANGUAGE SQL;
ALTER OPERATOR FAMILY alt_opf13 USING hash ADD FUNCTION 1 fn_opf13(int4);
ERROR: hash procedure 1 must return integer
ERROR: hash function 1 must return integer
DROP OPERATOR FAMILY alt_opf13 USING hash;
ERROR: current transaction is aborted, commands ignored until end of transaction block
ROLLBACK;
......@@ -430,7 +430,7 @@ BEGIN TRANSACTION;
CREATE OPERATOR FAMILY alt_opf14 USING btree;
CREATE FUNCTION fn_opf14 (int4) RETURNS BIGINT AS 'SELECT NULL::BIGINT;' LANGUAGE SQL;
ALTER OPERATOR FAMILY alt_opf14 USING btree ADD FUNCTION 1 fn_opf14(int4);
ERROR: btree comparison procedures must have two arguments
ERROR: btree comparison functions must have two arguments
DROP OPERATOR FAMILY alt_opf14 USING btree;
ERROR: current transaction is aborted, commands ignored until end of transaction block
ROLLBACK;
......@@ -439,7 +439,7 @@ BEGIN TRANSACTION;
CREATE OPERATOR FAMILY alt_opf15 USING hash;
CREATE FUNCTION fn_opf15 (int4, int2) RETURNS BIGINT AS 'SELECT NULL::BIGINT;' LANGUAGE SQL;
ALTER OPERATOR FAMILY alt_opf15 USING hash ADD FUNCTION 1 fn_opf15(int4, int2);
ERROR: hash procedure 1 must have one argument
ERROR: hash function 1 must have one argument
DROP OPERATOR FAMILY alt_opf15 USING hash;
ERROR: current transaction is aborted, commands ignored until end of transaction block
ROLLBACK;
......@@ -447,7 +447,7 @@ ROLLBACK;
-- without defining left / right type in ALTER OPERATOR FAMILY ... ADD FUNCTION
CREATE OPERATOR FAMILY alt_opf16 USING gist;
ALTER OPERATOR FAMILY alt_opf16 USING gist ADD FUNCTION 1 btint42cmp(int4, int2);
ERROR: associated data types must be specified for index support procedure
ERROR: associated data types must be specified for index support function
DROP OPERATOR FAMILY alt_opf16 USING gist;
-- Should fail. duplicate operator number / function number in ALTER OPERATOR FAMILY ... ADD FUNCTION
CREATE OPERATOR FAMILY alt_opf17 USING btree;
......@@ -464,7 +464,7 @@ ALTER OPERATOR FAMILY alt_opf17 USING btree ADD
OPERATOR 5 > (int4, int2) ,
FUNCTION 1 btint42cmp(int4, int2) ,
FUNCTION 1 btint42cmp(int4, int2); -- procedure 1 appears twice in same statement
ERROR: procedure number 1 for (integer,smallint) appears more than once
ERROR: function number 1 for (integer,smallint) appears more than once
ALTER OPERATOR FAMILY alt_opf17 USING btree ADD
OPERATOR 1 < (int4, int2) ,
OPERATOR 2 <= (int4, int2) ,
......
......@@ -185,11 +185,11 @@ CREATE OPERATOR ===
(
"Leftarg" = box,
"Rightarg" = box,
"Procedure" = area_equal_procedure,
"Procedure" = area_equal_function,
"Commutator" = ===,
"Negator" = !==,
"Restrict" = area_restriction_procedure,
"Join" = area_join_procedure,
"Restrict" = area_restriction_function,
"Join" = area_join_function,
"Hashes",
"Merges"
);
......
......@@ -189,11 +189,11 @@ CREATE OPERATOR ===
(
"Leftarg" = box,
"Rightarg" = box,
"Procedure" = area_equal_procedure,
"Procedure" = area_equal_function,
"Commutator" = ===,
"Negator" = !==,
"Restrict" = area_restriction_procedure,
"Join" = area_join_procedure,
"Restrict" = area_restriction_function,
"Join" = area_join_function,
"Hashes",
"Merges"
);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment