|
21 | 21 | * NOTES
|
22 | 22 | * These things must be defined and committed in the following order:
|
23 | 23 | * "create function":
|
24 |
| - * input/output, recv/send procedures |
| 24 | + * input/output, recv/send functions |
25 | 25 | * "create type":
|
26 | 26 | * type
|
27 | 27 | * "create operator":
|
@@ -79,8 +79,8 @@ DefineOperator(List *names, List *parameters)
|
79 | 79 | Oid rettype;
|
80 | 80 | List *commutatorName = NIL; /* optional commutator operator name */
|
81 | 81 | List *negatorName = NIL; /* optional negator operator name */
|
82 |
| - List *restrictionName = NIL; /* optional restrict. sel. procedure */ |
83 |
| - List *joinName = NIL; /* optional join sel. procedure */ |
| 82 | + List *restrictionName = NIL; /* optional restrict. sel. function */ |
| 83 | + List *joinName = NIL; /* optional join sel. function */ |
84 | 84 | Oid functionOid; /* functions converted to OID */
|
85 | 85 | Oid restrictionOid;
|
86 | 86 | Oid joinOid;
|
@@ -120,6 +120,9 @@ DefineOperator(List *names, List *parameters)
|
120 | 120 | (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
|
121 | 121 | errmsg("SETOF type not allowed for operator argument")));
|
122 | 122 | }
|
| 123 | + /* "function" and "procedure" are equivalent here */ |
| 124 | + else if (strcmp(defel->defname, "function") == 0) |
| 125 | + functionName = defGetQualifiedName(defel); |
123 | 126 | else if (strcmp(defel->defname, "procedure") == 0)
|
124 | 127 | functionName = defGetQualifiedName(defel);
|
125 | 128 | else if (strcmp(defel->defname, "commutator") == 0)
|
@@ -159,7 +162,7 @@ DefineOperator(List *names, List *parameters)
|
159 | 162 | if (functionName == NIL)
|
160 | 163 | ereport(ERROR,
|
161 | 164 | (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
|
162 |
| - errmsg("operator procedure must be specified"))); |
| 165 | + errmsg("operator function must be specified"))); |
163 | 166 |
|
164 | 167 | /* Transform type names to type OIDs */
|
165 | 168 | if (typeName1)
|
@@ -245,8 +248,8 @@ DefineOperator(List *names, List *parameters)
|
245 | 248 | functionOid, /* function for operator */
|
246 | 249 | commutatorName, /* optional commutator operator name */
|
247 | 250 | negatorName, /* optional negator operator name */
|
248 |
| - restrictionOid, /* optional restrict. sel. procedure */ |
249 |
| - joinOid, /* optional join sel. procedure name */ |
| 251 | + restrictionOid, /* optional restrict. sel. function */ |
| 252 | + joinOid, /* optional join sel. function name */ |
250 | 253 | canMerge, /* operator merges */
|
251 | 254 | canHash); /* operator hashes */
|
252 | 255 | }
|
@@ -393,10 +396,10 @@ AlterOperator(AlterOperatorStmt *stmt)
|
393 | 396 | Datum values[Natts_pg_operator];
|
394 | 397 | bool nulls[Natts_pg_operator];
|
395 | 398 | bool replaces[Natts_pg_operator];
|
396 |
| - List *restrictionName = NIL; /* optional restrict. sel. procedure */ |
| 399 | + List *restrictionName = NIL; /* optional restrict. sel. function */ |
397 | 400 | bool updateRestriction = false;
|
398 | 401 | Oid restrictionOid;
|
399 |
| - List *joinName = NIL; /* optional join sel. procedure */ |
| 402 | + List *joinName = NIL; /* optional join sel. function */ |
400 | 403 | bool updateJoin = false;
|
401 | 404 | Oid joinOid;
|
402 | 405 |
|
@@ -436,6 +439,7 @@ AlterOperator(AlterOperatorStmt *stmt)
|
436 | 439 | */
|
437 | 440 | else if (strcmp(defel->defname, "leftarg") == 0 ||
|
438 | 441 | strcmp(defel->defname, "rightarg") == 0 ||
|
| 442 | + strcmp(defel->defname, "function") == 0 || |
439 | 443 | strcmp(defel->defname, "procedure") == 0 ||
|
440 | 444 | strcmp(defel->defname, "commutator") == 0 ||
|
441 | 445 | strcmp(defel->defname, "negator") == 0 ||
|
|
0 commit comments