diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2018-08-15 17:01:39 +0200 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2018-08-22 14:44:49 +0200 |
commit | b19495772e48ecd32de9a906ddf8c25e16007575 (patch) | |
tree | f10d7f67307f654613adcf032546b3d52c0ed75a /src | |
parent | af63926cf577f4c30e43b7651e93e3a5eaa262e0 (diff) | |
download | postgresql-b19495772e48ecd32de9a906ddf8c25e16007575.tar.gz postgresql-b19495772e48ecd32de9a906ddf8c25e16007575.zip |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/access/gin/ginvalidate.c | 2 | ||||
-rw-r--r-- | src/backend/access/gist/gistvalidate.c | 2 | ||||
-rw-r--r-- | src/backend/access/hash/hashutil.c | 4 | ||||
-rw-r--r-- | src/backend/access/hash/hashvalidate.c | 4 | ||||
-rw-r--r-- | src/backend/access/spgist/spgvalidate.c | 2 | ||||
-rw-r--r-- | src/backend/commands/opclasscmds.c | 30 | ||||
-rw-r--r-- | src/bin/psql/describe.c | 2 | ||||
-rw-r--r-- | src/include/access/hash.h | 12 | ||||
-rw-r--r-- | src/test/regress/expected/alter_generic.out | 16 | ||||
-rw-r--r-- | src/test/regress/expected/create_operator.out | 6 | ||||
-rw-r--r-- | src/test/regress/sql/create_operator.sql | 6 |
11 files changed, 43 insertions, 43 deletions
diff --git a/src/backend/access/gin/ginvalidate.c b/src/backend/access/gin/ginvalidate.c index 1035be44634..1922260b756 100644 --- a/src/backend/access/gin/ginvalidate.c +++ b/src/backend/access/gin/ginvalidate.c @@ -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; diff --git a/src/backend/access/gist/gistvalidate.c b/src/backend/access/gist/gistvalidate.c index dd87dad386a..c300e52ca5f 100644 --- a/src/backend/access/gist/gistvalidate.c +++ b/src/backend/access/gist/gistvalidate.c @@ -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; diff --git a/src/backend/access/hash/hashutil.c b/src/backend/access/hash/hashutil.c index 4e485cc4b34..7c9b2cfc9ef 100644 --- a/src/backend/access/hash/hashutil.c +++ b/src/backend/access/hash/hashutil.c @@ -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) diff --git a/src/backend/access/hash/hashvalidate.c b/src/backend/access/hash/hashvalidate.c index 513a3bbc4c2..aac148fd350 100644 --- a/src/backend/access/hash/hashvalidate.c +++ b/src/backend/access/hash/hashvalidate.c @@ -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)) { diff --git a/src/backend/access/spgist/spgvalidate.c b/src/backend/access/spgist/spgvalidate.c index 619c357115a..c7acc7fc025 100644 --- a/src/backend/access/spgist/spgvalidate.c +++ b/src/backend/access/spgist/spgvalidate.c @@ -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; diff --git a/src/backend/commands/opclasscmds.c b/src/backend/commands/opclasscmds.c index e4b1369f193..3b5c90e3f41 100644 --- a/src/backend/commands/opclasscmds.c +++ b/src/backend/commands/opclasscmds.c @@ -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)))); diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index 80d8338b969..4f7e93fe024 100644 --- a/src/bin/psql/describe.c +++ b/src/bin/psql/describe.c @@ -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, diff --git a/src/include/access/hash.h b/src/include/access/hash.h index d6c306e9695..543d8029491 100644 --- a/src/include/access/hash.h +++ b/src/include/access/hash.h @@ -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 diff --git a/src/test/regress/expected/alter_generic.out b/src/test/regress/expected/alter_generic.out index f24a17f40e7..6faa9d739de 100644 --- a/src/test/regress/expected/alter_generic.out +++ b/src/test/regress/expected/alter_generic.out @@ -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) , diff --git a/src/test/regress/expected/create_operator.out b/src/test/regress/expected/create_operator.out index e35eb092505..fd8b37fff56 100644 --- a/src/test/regress/expected/create_operator.out +++ b/src/test/regress/expected/create_operator.out @@ -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" ); diff --git a/src/test/regress/sql/create_operator.sql b/src/test/regress/sql/create_operator.sql index c71765f9be5..9edf32b3f80 100644 --- a/src/test/regress/sql/create_operator.sql +++ b/src/test/regress/sql/create_operator.sql @@ -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" ); |