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: Peter Geoghegan <pg@bowt.ie>
Reviewed-by: Jonathan S. Katz <jonathan.katz@excoventures.com>
This commit is contained in:
Peter Eisentraut 2018-08-15 17:01:39 +02:00
parent af63926cf5
commit b19495772e
27 changed files with 175 additions and 182 deletions

View File

@ -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

View File

@ -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>

View File

@ -1053,9 +1053,9 @@ CREATE EVENT TRIGGER noddl ON ddl_command_start
<screen>
=# \dy
List of event triggers
Name | Event | Owner | Enabled | Procedure | Tags
-------+-------------------+-------+---------+-----------+------
noddl | ddl_command_start | dim | enabled | noddl |
Name | Event | Owner | Enabled | Function | Tags
-------+-------------------+-------+---------+----------+------
noddl | ddl_command_start | dim | enabled | noddl |
(1 row)
=# CREATE TABLE foo(id serial);

View File

@ -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>

View File

@ -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;

View File

@ -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>

View File

@ -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

View File

@ -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:

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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

View File

@ -21,23 +21,16 @@
<note>
<para>
The available procedural languages provide various means to
execute SQL commands from procedures. Most of these facilities are
execute SQL commands from functions. Most of these facilities are
based on SPI, so this documentation might be of use for users
of those languages as well.
</para>
</note>
<para>
To avoid misunderstanding we'll use the term <quote>function</quote>
when we speak of <acronym>SPI</acronym> interface functions and
<quote>procedure</quote> for a user-defined C-function that is
using <acronym>SPI</acronym>.
</para>
<para>
Note that if a command invoked via SPI fails, then control will not be
returned to your procedure. Rather, the
transaction or subtransaction in which your procedure executes will be
returned to your C function. Rather, the
transaction or subtransaction in which your C function executes will be
rolled back. (This might seem surprising given that the SPI functions mostly
have documented error-return conventions. Those conventions only apply
for errors detected within the SPI functions themselves, however.)
@ -73,7 +66,7 @@
<refnamediv>
<refname>SPI_connect</refname>
<refname>SPI_connect_ext</refname>
<refpurpose>connect a procedure to the SPI manager</refpurpose>
<refpurpose>connect a C function to the SPI manager</refpurpose>
</refnamediv>
<refsynopsisdiv>
@ -91,9 +84,9 @@ int SPI_connect_ext(int <parameter>options</parameter>)
<para>
<function>SPI_connect</function> opens a connection from a
procedure invocation to the SPI manager. You must call this
C function invocation to the SPI manager. You must call this
function if you want to execute commands through SPI. Some utility
SPI functions can be called from unconnected procedures.
SPI functions can be called from unconnected C functions.
</para>
<para>
@ -159,7 +152,7 @@ int SPI_connect_ext(int <parameter>options</parameter>)
<refnamediv>
<refname>SPI_finish</refname>
<refpurpose>disconnect a procedure from the SPI manager</refpurpose>
<refpurpose>disconnect a C function from the SPI manager</refpurpose>
</refnamediv>
<refsynopsisdiv>
@ -174,7 +167,7 @@ int SPI_finish(void)
<para>
<function>SPI_finish</function> closes an existing connection to
the SPI manager. You must call this function after completing the
SPI operations needed during your procedure's current invocation.
SPI operations needed during your C function's current invocation.
You do not need to worry about making this happen, however, if you
abort the transaction via <literal>elog(ERROR)</literal>. In that
case SPI will clean itself up automatically.
@ -198,7 +191,7 @@ int SPI_finish(void)
<term><symbol>SPI_ERROR_UNCONNECTED</symbol></term>
<listitem>
<para>
if called from an unconnected procedure
if called from an unconnected C function
</para>
</listitem>
</varlistentry>
@ -238,7 +231,7 @@ int SPI_execute(const char * <parameter>command</parameter>, bool <parameter>rea
</para>
<para>
This function can only be called from a connected procedure.
This function can only be called from a connected C function.
</para>
<para>
@ -345,7 +338,7 @@ typedef struct
<para>
<function>SPI_finish</function> frees all
<structname>SPITupleTable</structname>s allocated during the current
procedure. You can free a particular result table earlier, if you
C function. You can free a particular result table earlier, if you
are done with it, by calling <function>SPI_freetuptable</function>.
</para>
</refsect1>
@ -539,7 +532,7 @@ typedef struct
<term><symbol>SPI_ERROR_UNCONNECTED</symbol></term>
<listitem>
<para>
if called from an unconnected procedure
if called from an unconnected C function
</para>
</listitem>
</varlistentry>
@ -555,7 +548,7 @@ typedef struct
<varname>SPI_processed</varname> and
<varname>SPI_tuptable</varname> (just the pointer, not the contents
of the structure). Save these two global variables into local
procedure variables if you need to access the result table of
C function variables if you need to access the result table of
<function>SPI_execute</function> or another query-execution function
across later calls.
</para>
@ -835,7 +828,7 @@ SPIPlanPtr SPI_prepare(const char * <parameter>command</parameter>, int <paramet
<para>
The statement returned by <function>SPI_prepare</function> can be used
only in the current invocation of the procedure, since
only in the current invocation of the C function, since
<function>SPI_finish</function> frees memory allocated for such a
statement. But the statement can be saved for longer using the functions
<function>SPI_keepplan</function> or <function>SPI_saveplan</function>.
@ -926,7 +919,7 @@ SPIPlanPtr SPI_prepare(const char * <parameter>command</parameter>, int <paramet
</para>
<para>
This function should only be called from a connected procedure.
This function should only be called from a connected C function.
</para>
<para>
@ -1702,9 +1695,9 @@ Portal SPI_cursor_open(const char * <parameter>name</parameter>, SPIPlanPtr <par
Using a cursor instead of executing the statement directly has two
benefits. First, the result rows can be retrieved a few at a time,
avoiding memory overrun for queries that return many rows. Second,
a portal can outlive the current procedure (it can, in fact, live
a portal can outlive the current C function (it can, in fact, live
to the end of the current transaction). Returning the portal name
to the procedure's caller provides a way of returning a row set as
to the C function's caller provides a way of returning a row set as
result.
</para>
@ -2534,7 +2527,7 @@ int SPI_keepplan(SPIPlanPtr <parameter>plan</parameter>)
<function>SPI_prepare</function>) so that it will not be freed
by <function>SPI_finish</function> nor by the transaction manager.
This gives you the ability to reuse prepared statements in the subsequent
invocations of your procedure in the current session.
invocations of your C function in the current session.
</para>
</refsect1>
@ -2604,7 +2597,7 @@ SPIPlanPtr SPI_saveplan(SPIPlanPtr <parameter>plan</parameter>)
by <function>SPI_finish</function> nor by the transaction manager,
and returns a pointer to the copied statement. This gives you the
ability to reuse prepared statements in the subsequent invocations of
your procedure in the current session.
your C function in the current session.
</para>
</refsect1>
@ -2644,7 +2637,7 @@ SPIPlanPtr SPI_saveplan(SPIPlanPtr <parameter>plan</parameter>)
<term><symbol>SPI_ERROR_UNCONNECTED</symbol></term>
<listitem>
<para>
if called from an unconnected procedure
if called from an unconnected C function
</para>
</listitem>
</varlistentry>
@ -2757,7 +2750,7 @@ int SPI_register_relation(EphemeralNamedRelation <parameter>enr</parameter>)
<term><symbol>SPI_ERROR_UNCONNECTED</symbol></term>
<listitem>
<para>
if called from an unconnected procedure
if called from an unconnected C function
</para>
</listitem>
</varlistentry>
@ -2862,7 +2855,7 @@ int SPI_unregister_relation(const char * <parameter>name</parameter>)
<term><symbol>SPI_ERROR_UNCONNECTED</symbol></term>
<listitem>
<para>
if called from an unconnected procedure
if called from an unconnected C function
</para>
</listitem>
</varlistentry>
@ -2977,7 +2970,7 @@ int SPI_register_trigger_data(TriggerData *<parameter>tdata</parameter>)
<term><symbol>SPI_ERROR_UNCONNECTED</symbol></term>
<listitem>
<para>
if called from an unconnected procedure
if called from an unconnected C function
</para>
</listitem>
</varlistentry>
@ -3011,7 +3004,7 @@ int SPI_register_trigger_data(TriggerData *<parameter>tdata</parameter>)
<para>
All functions described in this section can be used by both
connected and unconnected procedures.
connected and unconnected C functions.
</para>
<!-- *********************************************** -->
@ -3655,37 +3648,37 @@ const char * SPI_result_code_string(int <parameter>code</parameter>);
makes it current. <function>SPI_finish</function> restores the
previous current memory context and destroys the context created by
<function>SPI_connect</function>. These actions ensure that
transient memory allocations made inside your procedure are
reclaimed at procedure exit, avoiding memory leakage.
transient memory allocations made inside your C function are
reclaimed at C function exit, avoiding memory leakage.
</para>
<para>
However, if your procedure needs to return an object in allocated
However, if your C function needs to return an object in allocated
memory (such as a value of a pass-by-reference data type), you
cannot allocate that memory using <function>palloc</function>, at
least not while you are connected to SPI. If you try, the object
will be deallocated by <function>SPI_finish</function>, and your
procedure will not work reliably. To solve this problem, use
C function will not work reliably. To solve this problem, use
<function>SPI_palloc</function> to allocate memory for your return
object. <function>SPI_palloc</function> allocates memory in the
<quote>upper executor context</quote>, that is, the memory context
that was current when <function>SPI_connect</function> was called,
which is precisely the right context for a value returned from your
procedure. Several of the other utility procedures described in
C function. Several of the other utility functions described in
this section also return objects created in the upper executor context.
</para>
<para>
When <function>SPI_connect</function> is called, the private
context of the procedure, which is created by
context of the C function, which is created by
<function>SPI_connect</function>, is made the current context. All
allocations made by <function>palloc</function>,
<function>repalloc</function>, or SPI utility functions (except as
described in this section) are made in this context. When a
procedure disconnects from the SPI manager (via
C function disconnects from the SPI manager (via
<function>SPI_finish</function>) the current context is restored to
the upper executor context, and all allocations made in the
procedure memory context are freed and cannot be used any more.
C function memory context are freed and cannot be used any more.
</para>
<!-- *********************************************** -->
@ -4263,12 +4256,12 @@ void SPI_freetuptable(SPITupleTable * <parameter>tuptable</parameter>)
</para>
<para>
This function is useful if a SPI procedure needs to execute
This function is useful if an SPI-using C function needs to execute
multiple commands and does not want to keep the results of earlier
commands around until it ends. Note that any unfreed row sets will
be freed anyway at <function>SPI_finish</function>.
Also, if a subtransaction is started and then aborted within execution
of a SPI procedure, SPI automatically frees any row sets created while
of an SPI-using C function, SPI automatically frees any row sets created while
the subtransaction was running.
</para>
@ -4373,9 +4366,9 @@ int SPI_freeplan(SPIPlanPtr <parameter>plan</parameter>)
is part of some SQL command will probably result in obscure internal errors
or crashes. The interface functions presented here are primarily intended
to be used by procedural language implementations to support transaction
management in procedures that are invoked by the <command>CALL</command>
management in SQL-level procedures that are invoked by the <command>CALL</command>
command, taking the context of the <command>CALL</command> invocation into
account. SPI procedures implemented in C can implement the same logic, but
account. SPI-using procedures implemented in C can implement the same logic, but
the details of that are beyond the scope of this documentation.
</para>
@ -4487,7 +4480,7 @@ void SPI_start_transaction(void)
<function>SPI_start_transaction</function> starts a new transaction. It
can only be called after <function>SPI_commit</function>
or <function>SPI_rollback</function>, as there is no transaction active at
that point. Normally, when an SPI procedure is called, there is already a
that point. Normally, when an SPI-using procedure is called, there is already a
transaction active, so attempting to start another one before closing out
the current one will result in an error.
</para>
@ -4566,7 +4559,7 @@ INSERT INTO a SELECT * FROM a;
<para>
This section contains a very simple example of SPI usage. The
procedure <function>execq</function> takes an SQL command as its
C function <function>execq</function> takes an SQL command as its
first argument and a row count as its second, executes the command
using <function>SPI_exec</function> and returns the number of rows
that were processed by the command. You can find more complex

View File

@ -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>

View File

@ -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>

View File

@ -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;

View File

@ -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;

View File

@ -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)

View File

@ -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))
{

View File

@ -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;

View File

@ -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))));

View File

@ -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,

View File

@ -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

View File

@ -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) ,

View File

@ -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"
);

View File

@ -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"
);