00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "postgres.h"
00019
00020 #include "access/heapam.h"
00021 #include "access/htup_details.h"
00022 #include "access/xact.h"
00023 #include "catalog/dependency.h"
00024 #include "catalog/indexing.h"
00025 #include "catalog/namespace.h"
00026 #include "catalog/objectaccess.h"
00027 #include "catalog/pg_namespace.h"
00028 #include "catalog/pg_operator.h"
00029 #include "catalog/pg_proc.h"
00030 #include "catalog/pg_type.h"
00031 #include "miscadmin.h"
00032 #include "parser/parse_oper.h"
00033 #include "utils/acl.h"
00034 #include "utils/builtins.h"
00035 #include "utils/lsyscache.h"
00036 #include "utils/rel.h"
00037 #include "utils/syscache.h"
00038
00039
00040 static Oid OperatorGet(const char *operatorName,
00041 Oid operatorNamespace,
00042 Oid leftObjectId,
00043 Oid rightObjectId,
00044 bool *defined);
00045
00046 static Oid OperatorLookup(List *operatorName,
00047 Oid leftObjectId,
00048 Oid rightObjectId,
00049 bool *defined);
00050
00051 static Oid OperatorShellMake(const char *operatorName,
00052 Oid operatorNamespace,
00053 Oid leftTypeId,
00054 Oid rightTypeId);
00055
00056 static void OperatorUpd(Oid baseId, Oid commId, Oid negId);
00057
00058 static Oid get_other_operator(List *otherOp,
00059 Oid otherLeftTypeId, Oid otherRightTypeId,
00060 const char *operatorName, Oid operatorNamespace,
00061 Oid leftTypeId, Oid rightTypeId,
00062 bool isCommutator);
00063
00064 static void makeOperatorDependencies(HeapTuple tuple);
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076 static bool
00077 validOperatorName(const char *name)
00078 {
00079 size_t len = strlen(name);
00080
00081
00082 if (len == 0 || len >= NAMEDATALEN)
00083 return false;
00084
00085
00086
00087 if (strspn(name, "~!@#^&|`?+-*/%<>=") != len)
00088 return false;
00089
00090
00091 if (strstr(name, "/*") || strstr(name, "--"))
00092 return false;
00093
00094
00095
00096
00097
00098
00099
00100
00101 if (len > 1 &&
00102 (name[len - 1] == '+' ||
00103 name[len - 1] == '-'))
00104 {
00105 int ic;
00106
00107 for (ic = len - 2; ic >= 0; ic--)
00108 {
00109 if (strchr("~!@#^&|`?%", name[ic]))
00110 break;
00111 }
00112 if (ic < 0)
00113 return false;
00114 }
00115
00116
00117 if (strcmp(name, "!=") == 0)
00118 return false;
00119
00120 return true;
00121 }
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132 static Oid
00133 OperatorGet(const char *operatorName,
00134 Oid operatorNamespace,
00135 Oid leftObjectId,
00136 Oid rightObjectId,
00137 bool *defined)
00138 {
00139 HeapTuple tup;
00140 Oid operatorObjectId;
00141
00142 tup = SearchSysCache4(OPERNAMENSP,
00143 PointerGetDatum(operatorName),
00144 ObjectIdGetDatum(leftObjectId),
00145 ObjectIdGetDatum(rightObjectId),
00146 ObjectIdGetDatum(operatorNamespace));
00147 if (HeapTupleIsValid(tup))
00148 {
00149 RegProcedure oprcode = ((Form_pg_operator) GETSTRUCT(tup))->oprcode;
00150
00151 operatorObjectId = HeapTupleGetOid(tup);
00152 *defined = RegProcedureIsValid(oprcode);
00153 ReleaseSysCache(tup);
00154 }
00155 else
00156 {
00157 operatorObjectId = InvalidOid;
00158 *defined = false;
00159 }
00160
00161 return operatorObjectId;
00162 }
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172 static Oid
00173 OperatorLookup(List *operatorName,
00174 Oid leftObjectId,
00175 Oid rightObjectId,
00176 bool *defined)
00177 {
00178 Oid operatorObjectId;
00179 RegProcedure oprcode;
00180
00181 operatorObjectId = LookupOperName(NULL, operatorName,
00182 leftObjectId, rightObjectId,
00183 true, -1);
00184 if (!OidIsValid(operatorObjectId))
00185 {
00186 *defined = false;
00187 return InvalidOid;
00188 }
00189
00190 oprcode = get_opcode(operatorObjectId);
00191 *defined = RegProcedureIsValid(oprcode);
00192
00193 return operatorObjectId;
00194 }
00195
00196
00197
00198
00199
00200
00201 static Oid
00202 OperatorShellMake(const char *operatorName,
00203 Oid operatorNamespace,
00204 Oid leftTypeId,
00205 Oid rightTypeId)
00206 {
00207 Relation pg_operator_desc;
00208 Oid operatorObjectId;
00209 int i;
00210 HeapTuple tup;
00211 Datum values[Natts_pg_operator];
00212 bool nulls[Natts_pg_operator];
00213 NameData oname;
00214 TupleDesc tupDesc;
00215
00216
00217
00218
00219 if (!validOperatorName(operatorName))
00220 ereport(ERROR,
00221 (errcode(ERRCODE_INVALID_NAME),
00222 errmsg("\"%s\" is not a valid operator name",
00223 operatorName)));
00224
00225
00226
00227
00228 for (i = 0; i < Natts_pg_operator; ++i)
00229 {
00230 nulls[i] = false;
00231 values[i] = (Datum) NULL;
00232 }
00233
00234
00235
00236
00237
00238 namestrcpy(&oname, operatorName);
00239 values[Anum_pg_operator_oprname - 1] = NameGetDatum(&oname);
00240 values[Anum_pg_operator_oprnamespace - 1] = ObjectIdGetDatum(operatorNamespace);
00241 values[Anum_pg_operator_oprowner - 1] = ObjectIdGetDatum(GetUserId());
00242 values[Anum_pg_operator_oprkind - 1] = CharGetDatum(leftTypeId ? (rightTypeId ? 'b' : 'r') : 'l');
00243 values[Anum_pg_operator_oprcanmerge - 1] = BoolGetDatum(false);
00244 values[Anum_pg_operator_oprcanhash - 1] = BoolGetDatum(false);
00245 values[Anum_pg_operator_oprleft - 1] = ObjectIdGetDatum(leftTypeId);
00246 values[Anum_pg_operator_oprright - 1] = ObjectIdGetDatum(rightTypeId);
00247 values[Anum_pg_operator_oprresult - 1] = ObjectIdGetDatum(InvalidOid);
00248 values[Anum_pg_operator_oprcom - 1] = ObjectIdGetDatum(InvalidOid);
00249 values[Anum_pg_operator_oprnegate - 1] = ObjectIdGetDatum(InvalidOid);
00250 values[Anum_pg_operator_oprcode - 1] = ObjectIdGetDatum(InvalidOid);
00251 values[Anum_pg_operator_oprrest - 1] = ObjectIdGetDatum(InvalidOid);
00252 values[Anum_pg_operator_oprjoin - 1] = ObjectIdGetDatum(InvalidOid);
00253
00254
00255
00256
00257 pg_operator_desc = heap_open(OperatorRelationId, RowExclusiveLock);
00258 tupDesc = pg_operator_desc->rd_att;
00259
00260
00261
00262
00263 tup = heap_form_tuple(tupDesc, values, nulls);
00264
00265
00266
00267
00268 operatorObjectId = simple_heap_insert(pg_operator_desc, tup);
00269
00270 CatalogUpdateIndexes(pg_operator_desc, tup);
00271
00272
00273 makeOperatorDependencies(tup);
00274
00275 heap_freetuple(tup);
00276
00277
00278 InvokeObjectPostCreateHook(OperatorRelationId, operatorObjectId, 0);
00279
00280
00281
00282
00283 CommandCounterIncrement();
00284
00285
00286
00287
00288 heap_close(pg_operator_desc, RowExclusiveLock);
00289
00290 return operatorObjectId;
00291 }
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328 Oid
00329 OperatorCreate(const char *operatorName,
00330 Oid operatorNamespace,
00331 Oid leftTypeId,
00332 Oid rightTypeId,
00333 Oid procedureId,
00334 List *commutatorName,
00335 List *negatorName,
00336 Oid restrictionId,
00337 Oid joinId,
00338 bool canMerge,
00339 bool canHash)
00340 {
00341 Relation pg_operator_desc;
00342 HeapTuple tup;
00343 bool nulls[Natts_pg_operator];
00344 bool replaces[Natts_pg_operator];
00345 Datum values[Natts_pg_operator];
00346 Oid operatorObjectId;
00347 bool operatorAlreadyDefined;
00348 Oid operResultType;
00349 Oid commutatorId,
00350 negatorId;
00351 bool selfCommutator = false;
00352 NameData oname;
00353 TupleDesc tupDesc;
00354 int i;
00355
00356
00357
00358
00359 if (!validOperatorName(operatorName))
00360 ereport(ERROR,
00361 (errcode(ERRCODE_INVALID_NAME),
00362 errmsg("\"%s\" is not a valid operator name",
00363 operatorName)));
00364
00365 if (!(OidIsValid(leftTypeId) && OidIsValid(rightTypeId)))
00366 {
00367
00368 if (commutatorName)
00369 ereport(ERROR,
00370 (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
00371 errmsg("only binary operators can have commutators")));
00372 if (OidIsValid(joinId))
00373 ereport(ERROR,
00374 (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
00375 errmsg("only binary operators can have join selectivity")));
00376 if (canMerge)
00377 ereport(ERROR,
00378 (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
00379 errmsg("only binary operators can merge join")));
00380 if (canHash)
00381 ereport(ERROR,
00382 (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
00383 errmsg("only binary operators can hash")));
00384 }
00385
00386 operResultType = get_func_rettype(procedureId);
00387
00388 if (operResultType != BOOLOID)
00389 {
00390
00391 if (negatorName)
00392 ereport(ERROR,
00393 (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
00394 errmsg("only boolean operators can have negators")));
00395 if (OidIsValid(restrictionId))
00396 ereport(ERROR,
00397 (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
00398 errmsg("only boolean operators can have restriction selectivity")));
00399 if (OidIsValid(joinId))
00400 ereport(ERROR,
00401 (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
00402 errmsg("only boolean operators can have join selectivity")));
00403 if (canMerge)
00404 ereport(ERROR,
00405 (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
00406 errmsg("only boolean operators can merge join")));
00407 if (canHash)
00408 ereport(ERROR,
00409 (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
00410 errmsg("only boolean operators can hash")));
00411 }
00412
00413 operatorObjectId = OperatorGet(operatorName,
00414 operatorNamespace,
00415 leftTypeId,
00416 rightTypeId,
00417 &operatorAlreadyDefined);
00418
00419 if (operatorAlreadyDefined)
00420 ereport(ERROR,
00421 (errcode(ERRCODE_DUPLICATE_FUNCTION),
00422 errmsg("operator %s already exists",
00423 operatorName)));
00424
00425
00426
00427
00428
00429
00430 if (OidIsValid(operatorObjectId) &&
00431 !pg_oper_ownercheck(operatorObjectId, GetUserId()))
00432 aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_OPER,
00433 operatorName);
00434
00435
00436
00437
00438
00439
00440 if (commutatorName)
00441 {
00442
00443 commutatorId = get_other_operator(commutatorName,
00444 rightTypeId, leftTypeId,
00445 operatorName, operatorNamespace,
00446 leftTypeId, rightTypeId,
00447 true);
00448
00449
00450 if (OidIsValid(commutatorId) &&
00451 !pg_oper_ownercheck(commutatorId, GetUserId()))
00452 aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_OPER,
00453 NameListToString(commutatorName));
00454
00455
00456
00457
00458
00459 if (!OidIsValid(commutatorId))
00460 selfCommutator = true;
00461 }
00462 else
00463 commutatorId = InvalidOid;
00464
00465 if (negatorName)
00466 {
00467
00468 negatorId = get_other_operator(negatorName,
00469 leftTypeId, rightTypeId,
00470 operatorName, operatorNamespace,
00471 leftTypeId, rightTypeId,
00472 false);
00473
00474
00475 if (OidIsValid(negatorId) &&
00476 !pg_oper_ownercheck(negatorId, GetUserId()))
00477 aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_OPER,
00478 NameListToString(negatorName));
00479 }
00480 else
00481 negatorId = InvalidOid;
00482
00483
00484
00485
00486
00487 for (i = 0; i < Natts_pg_operator; ++i)
00488 {
00489 values[i] = (Datum) NULL;
00490 replaces[i] = true;
00491 nulls[i] = false;
00492 }
00493
00494 namestrcpy(&oname, operatorName);
00495 values[Anum_pg_operator_oprname - 1] = NameGetDatum(&oname);
00496 values[Anum_pg_operator_oprnamespace - 1] = ObjectIdGetDatum(operatorNamespace);
00497 values[Anum_pg_operator_oprowner - 1] = ObjectIdGetDatum(GetUserId());
00498 values[Anum_pg_operator_oprkind - 1] = CharGetDatum(leftTypeId ? (rightTypeId ? 'b' : 'r') : 'l');
00499 values[Anum_pg_operator_oprcanmerge - 1] = BoolGetDatum(canMerge);
00500 values[Anum_pg_operator_oprcanhash - 1] = BoolGetDatum(canHash);
00501 values[Anum_pg_operator_oprleft - 1] = ObjectIdGetDatum(leftTypeId);
00502 values[Anum_pg_operator_oprright - 1] = ObjectIdGetDatum(rightTypeId);
00503 values[Anum_pg_operator_oprresult - 1] = ObjectIdGetDatum(operResultType);
00504 values[Anum_pg_operator_oprcom - 1] = ObjectIdGetDatum(commutatorId);
00505 values[Anum_pg_operator_oprnegate - 1] = ObjectIdGetDatum(negatorId);
00506 values[Anum_pg_operator_oprcode - 1] = ObjectIdGetDatum(procedureId);
00507 values[Anum_pg_operator_oprrest - 1] = ObjectIdGetDatum(restrictionId);
00508 values[Anum_pg_operator_oprjoin - 1] = ObjectIdGetDatum(joinId);
00509
00510 pg_operator_desc = heap_open(OperatorRelationId, RowExclusiveLock);
00511
00512
00513
00514
00515 if (operatorObjectId)
00516 {
00517 tup = SearchSysCacheCopy1(OPEROID,
00518 ObjectIdGetDatum(operatorObjectId));
00519 if (!HeapTupleIsValid(tup))
00520 elog(ERROR, "cache lookup failed for operator %u",
00521 operatorObjectId);
00522
00523 tup = heap_modify_tuple(tup,
00524 RelationGetDescr(pg_operator_desc),
00525 values,
00526 nulls,
00527 replaces);
00528
00529 simple_heap_update(pg_operator_desc, &tup->t_self, tup);
00530 }
00531 else
00532 {
00533 tupDesc = pg_operator_desc->rd_att;
00534 tup = heap_form_tuple(tupDesc, values, nulls);
00535
00536 operatorObjectId = simple_heap_insert(pg_operator_desc, tup);
00537 }
00538
00539
00540 CatalogUpdateIndexes(pg_operator_desc, tup);
00541
00542
00543 makeOperatorDependencies(tup);
00544
00545
00546 InvokeObjectPostCreateHook(OperatorRelationId, operatorObjectId, 0);
00547
00548 heap_close(pg_operator_desc, RowExclusiveLock);
00549
00550
00551
00552
00553
00554
00555
00556
00557
00558
00559
00560
00561 if (selfCommutator)
00562 commutatorId = operatorObjectId;
00563
00564 if (OidIsValid(commutatorId) || OidIsValid(negatorId))
00565 OperatorUpd(operatorObjectId, commutatorId, negatorId);
00566
00567 return operatorObjectId;
00568 }
00569
00570
00571
00572
00573
00574
00575
00576
00577
00578 static Oid
00579 get_other_operator(List *otherOp, Oid otherLeftTypeId, Oid otherRightTypeId,
00580 const char *operatorName, Oid operatorNamespace,
00581 Oid leftTypeId, Oid rightTypeId, bool isCommutator)
00582 {
00583 Oid other_oid;
00584 bool otherDefined;
00585 char *otherName;
00586 Oid otherNamespace;
00587 AclResult aclresult;
00588
00589 other_oid = OperatorLookup(otherOp,
00590 otherLeftTypeId,
00591 otherRightTypeId,
00592 &otherDefined);
00593
00594 if (OidIsValid(other_oid))
00595 {
00596
00597 return other_oid;
00598 }
00599
00600 otherNamespace = QualifiedNameGetCreationNamespace(otherOp,
00601 &otherName);
00602
00603 if (strcmp(otherName, operatorName) == 0 &&
00604 otherNamespace == operatorNamespace &&
00605 otherLeftTypeId == leftTypeId &&
00606 otherRightTypeId == rightTypeId)
00607 {
00608
00609
00610
00611
00612 if (!isCommutator)
00613 ereport(ERROR,
00614 (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
00615 errmsg("operator cannot be its own negator or sort operator")));
00616 return InvalidOid;
00617 }
00618
00619
00620
00621 aclresult = pg_namespace_aclcheck(otherNamespace, GetUserId(),
00622 ACL_CREATE);
00623 if (aclresult != ACLCHECK_OK)
00624 aclcheck_error(aclresult, ACL_KIND_NAMESPACE,
00625 get_namespace_name(otherNamespace));
00626
00627 other_oid = OperatorShellMake(otherName,
00628 otherNamespace,
00629 otherLeftTypeId,
00630 otherRightTypeId);
00631 return other_oid;
00632 }
00633
00634
00635
00636
00637
00638
00639
00640
00641
00642
00643 static void
00644 OperatorUpd(Oid baseId, Oid commId, Oid negId)
00645 {
00646 int i;
00647 Relation pg_operator_desc;
00648 HeapTuple tup;
00649 bool nulls[Natts_pg_operator];
00650 bool replaces[Natts_pg_operator];
00651 Datum values[Natts_pg_operator];
00652
00653 for (i = 0; i < Natts_pg_operator; ++i)
00654 {
00655 values[i] = (Datum) 0;
00656 replaces[i] = false;
00657 nulls[i] = false;
00658 }
00659
00660
00661
00662
00663
00664
00665
00666 CommandCounterIncrement();
00667
00668 pg_operator_desc = heap_open(OperatorRelationId, RowExclusiveLock);
00669
00670 tup = SearchSysCacheCopy1(OPEROID, ObjectIdGetDatum(commId));
00671
00672
00673
00674
00675
00676
00677 if (commId == negId)
00678 {
00679 if (HeapTupleIsValid(tup))
00680 {
00681 Form_pg_operator t = (Form_pg_operator) GETSTRUCT(tup);
00682
00683 if (!OidIsValid(t->oprcom) || !OidIsValid(t->oprnegate))
00684 {
00685 if (!OidIsValid(t->oprnegate))
00686 {
00687 values[Anum_pg_operator_oprnegate - 1] = ObjectIdGetDatum(baseId);
00688 replaces[Anum_pg_operator_oprnegate - 1] = true;
00689 }
00690
00691 if (!OidIsValid(t->oprcom))
00692 {
00693 values[Anum_pg_operator_oprcom - 1] = ObjectIdGetDatum(baseId);
00694 replaces[Anum_pg_operator_oprcom - 1] = true;
00695 }
00696
00697 tup = heap_modify_tuple(tup,
00698 RelationGetDescr(pg_operator_desc),
00699 values,
00700 nulls,
00701 replaces);
00702
00703 simple_heap_update(pg_operator_desc, &tup->t_self, tup);
00704
00705 CatalogUpdateIndexes(pg_operator_desc, tup);
00706 }
00707 }
00708
00709 heap_close(pg_operator_desc, RowExclusiveLock);
00710
00711 return;
00712 }
00713
00714
00715
00716 if (HeapTupleIsValid(tup) &&
00717 !(OidIsValid(((Form_pg_operator) GETSTRUCT(tup))->oprcom)))
00718 {
00719 values[Anum_pg_operator_oprcom - 1] = ObjectIdGetDatum(baseId);
00720 replaces[Anum_pg_operator_oprcom - 1] = true;
00721
00722 tup = heap_modify_tuple(tup,
00723 RelationGetDescr(pg_operator_desc),
00724 values,
00725 nulls,
00726 replaces);
00727
00728 simple_heap_update(pg_operator_desc, &tup->t_self, tup);
00729
00730 CatalogUpdateIndexes(pg_operator_desc, tup);
00731
00732 values[Anum_pg_operator_oprcom - 1] = (Datum) NULL;
00733 replaces[Anum_pg_operator_oprcom - 1] = false;
00734 }
00735
00736
00737
00738 tup = SearchSysCacheCopy1(OPEROID, ObjectIdGetDatum(negId));
00739
00740 if (HeapTupleIsValid(tup) &&
00741 !(OidIsValid(((Form_pg_operator) GETSTRUCT(tup))->oprnegate)))
00742 {
00743 values[Anum_pg_operator_oprnegate - 1] = ObjectIdGetDatum(baseId);
00744 replaces[Anum_pg_operator_oprnegate - 1] = true;
00745
00746 tup = heap_modify_tuple(tup,
00747 RelationGetDescr(pg_operator_desc),
00748 values,
00749 nulls,
00750 replaces);
00751
00752 simple_heap_update(pg_operator_desc, &tup->t_self, tup);
00753
00754 CatalogUpdateIndexes(pg_operator_desc, tup);
00755 }
00756
00757 heap_close(pg_operator_desc, RowExclusiveLock);
00758 }
00759
00760
00761
00762
00763
00764
00765
00766
00767 static void
00768 makeOperatorDependencies(HeapTuple tuple)
00769 {
00770 Form_pg_operator oper = (Form_pg_operator) GETSTRUCT(tuple);
00771 ObjectAddress myself,
00772 referenced;
00773
00774 myself.classId = OperatorRelationId;
00775 myself.objectId = HeapTupleGetOid(tuple);
00776 myself.objectSubId = 0;
00777
00778
00779
00780
00781
00782 deleteDependencyRecordsFor(myself.classId, myself.objectId, true);
00783 deleteSharedDependencyRecordsFor(myself.classId, myself.objectId, 0);
00784
00785
00786 if (OidIsValid(oper->oprnamespace))
00787 {
00788 referenced.classId = NamespaceRelationId;
00789 referenced.objectId = oper->oprnamespace;
00790 referenced.objectSubId = 0;
00791 recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
00792 }
00793
00794
00795 if (OidIsValid(oper->oprleft))
00796 {
00797 referenced.classId = TypeRelationId;
00798 referenced.objectId = oper->oprleft;
00799 referenced.objectSubId = 0;
00800 recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
00801 }
00802
00803
00804 if (OidIsValid(oper->oprright))
00805 {
00806 referenced.classId = TypeRelationId;
00807 referenced.objectId = oper->oprright;
00808 referenced.objectSubId = 0;
00809 recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
00810 }
00811
00812
00813 if (OidIsValid(oper->oprresult))
00814 {
00815 referenced.classId = TypeRelationId;
00816 referenced.objectId = oper->oprresult;
00817 referenced.objectSubId = 0;
00818 recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
00819 }
00820
00821
00822
00823
00824
00825
00826
00827
00828
00829
00830
00831 if (OidIsValid(oper->oprcode))
00832 {
00833 referenced.classId = ProcedureRelationId;
00834 referenced.objectId = oper->oprcode;
00835 referenced.objectSubId = 0;
00836 recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
00837 }
00838
00839
00840 if (OidIsValid(oper->oprrest))
00841 {
00842 referenced.classId = ProcedureRelationId;
00843 referenced.objectId = oper->oprrest;
00844 referenced.objectSubId = 0;
00845 recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
00846 }
00847
00848
00849 if (OidIsValid(oper->oprjoin))
00850 {
00851 referenced.classId = ProcedureRelationId;
00852 referenced.objectId = oper->oprjoin;
00853 referenced.objectSubId = 0;
00854 recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
00855 }
00856
00857
00858 recordDependencyOnOwner(OperatorRelationId, HeapTupleGetOid(tuple),
00859 oper->oprowner);
00860
00861
00862 recordDependencyOnCurrentExtension(&myself, true);
00863 }