| 1 | /*------------------------------------------------------------------------- |
| 2 | * |
| 3 | * pg_operator.h |
| 4 | * definition of the "operator" system catalog (pg_operator) |
| 5 | * |
| 6 | * |
| 7 | * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group |
| 8 | * Portions Copyright (c) 1994, Regents of the University of California |
| 9 | * |
| 10 | * src/include/catalog/pg_operator.h |
| 11 | * |
| 12 | * NOTES |
| 13 | * The Catalog.pm module reads this file and derives schema |
| 14 | * information. |
| 15 | * |
| 16 | *------------------------------------------------------------------------- |
| 17 | */ |
| 18 | #ifndef PG_OPERATOR_H |
| 19 | #define PG_OPERATOR_H |
| 20 | |
| 21 | #include "catalog/genbki.h" |
| 22 | #include "catalog/pg_operator_d.h" |
| 23 | |
| 24 | #include "catalog/objectaddress.h" |
| 25 | #include "nodes/pg_list.h" |
| 26 | |
| 27 | /* ---------------- |
| 28 | * pg_operator definition. cpp turns this into |
| 29 | * typedef struct FormData_pg_operator |
| 30 | * ---------------- |
| 31 | */ |
| 32 | CATALOG(pg_operator,2617,OperatorRelationId) |
| 33 | { |
| 34 | Oid oid; /* oid */ |
| 35 | |
| 36 | /* name of operator */ |
| 37 | NameData oprname; |
| 38 | |
| 39 | /* OID of namespace containing this oper */ |
| 40 | Oid oprnamespace BKI_DEFAULT(PGNSP); |
| 41 | |
| 42 | /* operator owner */ |
| 43 | Oid oprowner BKI_DEFAULT(PGUID); |
| 44 | |
| 45 | /* 'l', 'r', or 'b' */ |
| 46 | char oprkind BKI_DEFAULT(b); |
| 47 | |
| 48 | /* can be used in merge join? */ |
| 49 | bool oprcanmerge BKI_DEFAULT(f); |
| 50 | |
| 51 | /* can be used in hash join? */ |
| 52 | bool oprcanhash BKI_DEFAULT(f); |
| 53 | |
| 54 | /* left arg type, or 0 if 'l' oprkind */ |
| 55 | Oid oprleft BKI_LOOKUP(pg_type); |
| 56 | |
| 57 | /* right arg type, or 0 if 'r' oprkind */ |
| 58 | Oid oprright BKI_LOOKUP(pg_type); |
| 59 | |
| 60 | /* result datatype */ |
| 61 | Oid oprresult BKI_LOOKUP(pg_type); |
| 62 | |
| 63 | /* OID of commutator oper, or 0 if none */ |
| 64 | Oid oprcom BKI_DEFAULT(0) BKI_LOOKUP(pg_operator); |
| 65 | |
| 66 | /* OID of negator oper, or 0 if none */ |
| 67 | Oid oprnegate BKI_DEFAULT(0) BKI_LOOKUP(pg_operator); |
| 68 | |
| 69 | /* OID of underlying function */ |
| 70 | regproc oprcode BKI_LOOKUP(pg_proc); |
| 71 | |
| 72 | /* OID of restriction estimator, or 0 */ |
| 73 | regproc oprrest BKI_DEFAULT(-) BKI_LOOKUP(pg_proc); |
| 74 | |
| 75 | /* OID of join estimator, or 0 */ |
| 76 | regproc oprjoin BKI_DEFAULT(-) BKI_LOOKUP(pg_proc); |
| 77 | } FormData_pg_operator; |
| 78 | |
| 79 | /* ---------------- |
| 80 | * Form_pg_operator corresponds to a pointer to a tuple with |
| 81 | * the format of pg_operator relation. |
| 82 | * ---------------- |
| 83 | */ |
| 84 | typedef FormData_pg_operator *Form_pg_operator; |
| 85 | |
| 86 | |
| 87 | extern ObjectAddress OperatorCreate(const char *operatorName, |
| 88 | Oid operatorNamespace, |
| 89 | Oid leftTypeId, |
| 90 | Oid rightTypeId, |
| 91 | Oid procedureId, |
| 92 | List *commutatorName, |
| 93 | List *negatorName, |
| 94 | Oid restrictionId, |
| 95 | Oid joinId, |
| 96 | bool canMerge, |
| 97 | bool canHash); |
| 98 | |
| 99 | extern ObjectAddress makeOperatorDependencies(HeapTuple tuple, bool isUpdate); |
| 100 | |
| 101 | extern void OperatorUpd(Oid baseId, Oid commId, Oid negId, bool isDelete); |
| 102 | |
| 103 | #endif /* PG_OPERATOR_H */ |
| 104 | |