amprocnum
int2
- Support procedure number
+ Support function number
|
amproc
regproc
pg_proc .oid
- OID of the procedure
+ OID of the function
The usual interpretation of the
amproclefttype and amprocrighttype 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 default
support procedure s 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 default
support function s for
an index, which are those with amproclefttype and
amprocrighttype both equal to the index operator class's
opcintype .
The catalog pg_conversion describes
- encoding conversion procedure s. See
+ encoding conversion function s. See
for more information.
conproc
regproc
pg_proc .oid
- Conversion procedure
+ Conversion function
|
=# \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);
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.
if (CALLED_AS_TRIGGER(fcinfo))
{
/*
- * Called as a trigger procedure
+ * Called as a trigger function
*/
TriggerData *trigdata = (TriggerData *) fcinfo->context;
- The return value of the trigger procedure is ignored.
+ The return value of the trigger function is ignored.
- can be used to create functions and trigger procedure s,
+ can be used to create functions and triggers,
for transaction
control.
PL/pgSQL 's
BEGIN /
END
are only for grouping; they do not start or end a transaction.
- Functions and trigger procedures a re always executed within a transaction
+ Functions are always executed within a transaction
established by an outer query — they cannot start or commit that
transaction, since there would be no context for them to execute in.
However, a block containing an EXCEPTION clause effectively
function parameters. The main practical use for this is to assign
a different name for variables with predetermined names, such as
NEW or OLD within
- a trigger procedure .
+ a trigger function .
-
Trigger Procedure s
+
Trigger Function s
PL/pgSQL can be used to define trigger
- procedure s on data changes or database events.
- A trigger procedure is created with the CREATE FUNCTION
+ function s on data changes or database events.
+ A trigger function is created with the CREATE FUNCTION
command, declaring it as a function with no arguments and a return type of
trigger (for data change triggers) or
event_trigger (for database event triggers).
Data type integer ; the number of arguments given to the trigger
- procedure in the CREATE TRIGGER statement.
+ function in the CREATE TRIGGER statement.
shows an example of a
- trigger
procedure in
PL/pgSQL .
+ trigger
function in
PL/pgSQL .
-
A PL/pgSQL Trigger Procedure
+
A PL/pgSQL Trigger Function
This example trigger ensures that any time a row is inserted or updated
holds a row for each insert, update, or delete that occurs. This approach
can be thought of as auditing changes to a table.
shows an example of an
- audit trigger
procedure in
PL/pgSQL .
+ audit trigger
function in
PL/pgSQL .
-
A PL/pgSQL Trigger Procedure For Auditing
+
A PL/pgSQL Trigger Function For Auditing
This example trigger ensures that any insert, update or delete of a row
-
A PL/pgSQL View Trigger Procedure For Auditing
+
A PL/pgSQL View Trigger Function For Auditing
This example uses a trigger on the view to make it updatable, and
This technique is commonly used in Data Warehousing, where the tables
of measured or observed data (called fact tables) might be extremely large.
shows an example of a
- trigger
procedure in
PL/pgSQL that maintains
+ trigger
function in
PL/pgSQL that maintains
a summary table for a fact table in a data warehouse.
-
A PL/pgSQL Trigger Procedure For Maintaining A Summary Table
+
A PL/pgSQL Trigger Function For Maintaining A Summary Table
The schema detailed here is partly based on the Grocery Store
PL/pgSQL can be used to define
event triggers.
-
PostgreSQL requires that a
procedure that
+
PostgreSQL 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 event_trigger .
shows an example of an
- event trigger
procedure in
PL/pgSQL .
+ event trigger
function in
PL/pgSQL .
-
A PL/pgSQL Event Trigger Procedure
+
A PL/pgSQL Event Trigger Function
This example trigger simply raises a NOTICE message
PL/Tcl is a loadable procedural language for the
PostgreSQL database system
- Tcl language to be used to write functions and
- trigger procedure s.
+ Tcl language to be used to write
-
Trigger Procedure s in PL/Tcl
+
Trigger Function s in PL/Tcl
- Trigger procedure s can be written in PL/Tcl.
-
PostgreSQL requires that a
procedure that is to be called
+ Trigger function s can be written in PL/Tcl.
+
PostgreSQL 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 trigger .
- 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:
$TG_relid
- 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.
$TG_table_name
- The name of the table that caused the trigger procedure
+ The name of the table that caused the trigger function
to be invoked.
$TG_table_schema
- The schema of the table that caused the trigger procedure
+ The schema of the table that caused the trigger function
to be invoked.
$args
- 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
CREATE TRIGGER statement. These arguments are also accessible as
- $1 ... $n in the procedure body.
+ $1 ... $n in the function body.
- 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
OK or SKIP , or a list of column name/value pairs.
If the return value is OK ,
the operation (INSERT /UPDATE /DELETE )
- 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.
FOR EACH ROW EXECUTE PROCEDURE trigfunc_modcount('modcnt');
- 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.
-
Event Trigger Procedure s in PL/Tcl
+
Event Trigger Function s in PL/Tcl
- Event trigger procedure s can be written in PL/Tcl.
-
PostgreSQL requires that a
procedure that is
+ Event trigger function s can be written in PL/Tcl.
+
PostgreSQL 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 event_trigger .
- 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:
- The return value of the trigger procedure is ignored.
+ The return value of the trigger function is ignored.
- Here's a little example event trigger procedure that simply raises
+ Here's a little example event trigger function that simply raises
a NOTICE message each time a supported command is
executed:
support_number
- The index method's support procedure number for a
+ The index method's support function number for a
function associated with the operator family.
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.
CREATE LANGUAGE registers a new
procedural language with a
PostgreSQL
- database. Subsequently, functions and trigger procedures can be
+ database. Subsequently, functions and procedures can be
defined in this new language.
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 strategies
for this data type and this
- index method. The operator class also specifies the support procedure s to
+ index method. The operator class also specifies the support function s 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
support_number
- The index method's support procedure number for a
+ The index method's support function number for a
function associated with the operator class.
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.
The function_name
- procedure must have been previously defined using CREATE
+ function must have been previously defined using CREATE
FUNCTION and must be defined to accept the correct number
of arguments (either one or two) of the indicated types.
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
);
- 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, FOR EACH
STATEMENT is the default. Constraint triggers can only
The available procedural languages provide various means to
- execute SQL commands from procedure s. Most of these facilities are
+ execute SQL commands from function s. Most of these facilities are
based on SPI, so this documentation might be of use for users
of those languages as well.
- To avoid misunderstanding we'll use the term function
- when we speak of
SPI interface functions and
- procedure
for a user-defined C-function that is
-
-
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.)
SPI_connect
SPI_connect_ext
- connect a procedure to the SPI manager
+ connect a C function to the SPI manager
SPI_connect 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 procedure s.
+ SPI functions can be called from unconnected C function s.
SPI_finish
- disconnect a procedure from the SPI manager
+ disconnect a C function from the SPI manager
SPI_finish 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 elog(ERROR) . In that
case SPI will clean itself up automatically.
SPI_ERROR_UNCONNECTED
- if called from an unconnected procedure
+ if called from an unconnected C function
- This function can only be called from a connected procedure .
+ This function can only be called from a connected C function .
SPI_finish frees all
SPITupleTable 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 SPI_freetuptable .
SPI_ERROR_UNCONNECTED
- if called from an unconnected procedure
+ if called from an unconnected C function
SPI_processed and
SPI_tuptable (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
SPI_execute or another query-execution function
across later calls.
The statement returned by SPI_prepare can be used
- only in the current invocation of the procedure , since
+ only in the current invocation of the C function , since
SPI_finish frees memory allocated for such a
statement. But the statement can be saved for longer using the functions
SPI_keepplan or SPI_saveplan .
- This function should only be called from a connected procedure .
+ This function should only be called from a connected C function .
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.
SPI_prepare ) so that it will not be freed
by SPI_finish 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.
by SPI_finish 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.
SPI_ERROR_UNCONNECTED
- if called from an unconnected procedure
+ if called from an unconnected C function
SPI_ERROR_UNCONNECTED
- if called from an unconnected procedure
+ if called from an unconnected C function
SPI_ERROR_UNCONNECTED
- if called from an unconnected procedure
+ if called from an unconnected C function
SPI_ERROR_UNCONNECTED
- if called from an unconnected procedure
+ if called from an unconnected C function
All functions described in this section can be used by both
- connected and unconnected procedure s.
+ connected and unconnected C function s.
makes it current. SPI_finish restores the
previous current memory context and destroys the context created by
SPI_connect . 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.
- 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 palloc , at
least not while you are connected to SPI. If you try, the object
will be deallocated by SPI_finish , and your
- procedure will not work reliably. To solve this problem, use
+ C function will not work reliably. To solve this problem, use
SPI_palloc to allocate memory for your return
object. SPI_palloc allocates memory in the
upper executor context
, that is, the memory context
that was current when SPI_connect was called,
which is precisely the right context for a value returned from your
- procedure. Several of the other utility procedure s described in
+ C function. Several of the other utility function s described in
this section also return objects created in the upper executor context.
When SPI_connect is called, the private
- context of the procedure , which is created by
+ context of the C function , which is created by
SPI_connect , is made the current context. All
allocations made by palloc ,
repalloc , 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
SPI_finish ) 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.
- 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 SPI_finish .
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.
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 CALL
+ management in SQL-level procedures that are invoked by the CALL
command, taking the context of the CALL 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.
SPI_start_transaction starts a new transaction. It
can only be called after SPI_commit
or SPI_rollback , 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.
This section contains a very simple example of SPI usage. The
- procedure execq takes an SQL command as its
+ C function execq takes an SQL command as its
first argument and a row count as its second, executes the command
using SPI_exec and returns the number of rows
that were processed by the command. You can find more complex
WHERE -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 support
- procedures that are needed by the internal operations of the
+ function that are needed by the internal operations of the
index method, but do not directly correspond to any
WHERE -clause operator that can be used with the index.
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 TRUSTED flag should only be given
for languages that do not allow access to database server
VALIDATOR plperl_validator;
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 plperl .
{
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;
{
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;
}
/*
- * _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)
{
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;
result = false;
}
- /* There should be relevant hash procedure s for each datatype */
+ /* There should be relevant hash function s for each datatype */
if (!list_member_oid(hashabletypes, oprform->amoplefttype) ||
!list_member_oid(hashabletypes, oprform->amoprighttype))
{
{
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;
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);
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);
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);
if (procform->pronargs != 2)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
- errmsg("btree comparison procedure s must have two arguments")));
+ errmsg("btree comparison function s must have two arguments")));
if (procform->prorettype != INT4OID)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
- errmsg("btree comparison procedure s must return integer")));
+ errmsg("btree comparison function s must return integer")));
/*
* If lefttype/righttype isn't specified, use the proc's input
procform->proargtypes.values[0] != INTERNALOID)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
- errmsg("btree sort support procedure s must accept type \"internal\"")));
+ errmsg("btree sort support function s must accept type \"internal\"")));
if (procform->prorettype != VOIDOID)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
- errmsg("btree sort support procedure s must return void")));
+ errmsg("btree sort support function s must return void")));
/*
* Can't infer lefttype/righttype from proc, so use default rule
if (procform->pronargs != 5)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
- errmsg("btree in_range procedure s must have five arguments")));
+ errmsg("btree in_range function s must have five arguments")));
if (procform->prorettype != BOOLOID)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
- errmsg("btree in_range procedure s must return boolean")));
+ errmsg("btree in_range function s must return boolean")));
/*
* If lefttype/righttype isn't specified, use the proc's input
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")));
}
/*
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);
}
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))));
gettext_noop("always"),
gettext_noop("disabled"),
gettext_noop("Enabled"),
- gettext_noop("Procedure "),
+ gettext_noop("Function "),
gettext_noop("Tags"));
if (verbose)
appendPQExpBuffer(&buf,
* 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 */
/*
* 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
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;
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 procedure s must return integer
+ERROR: btree comparison function s must return integer
DROP OPERATOR FAMILY alt_opf12 USING btree;
ERROR: current transaction is aborted, commands ignored until end of transaction block
ROLLBACK;
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;
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 procedure s must have two arguments
+ERROR: btree comparison function s must have two arguments
DROP OPERATOR FAMILY alt_opf14 USING btree;
ERROR: current transaction is aborted, commands ignored until end of transaction block
ROLLBACK;
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;
-- 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;
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) ,
(
"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"
);
(
"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"
);