PostgreSQL Source Code git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
pg_operator.h
Go to the documentation of this file.
1/*-------------------------------------------------------------------------
2 *
3 * pg_operator.h
4 * definition of the "operator" system catalog (pg_operator)
5 *
6 *
7 * Portions Copyright (c) 1996-2025, 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"
23#include "catalog/pg_operator_d.h" /* IWYU pragma: export */
24#include "nodes/pg_list.h"
25
26/* ----------------
27 * pg_operator definition. cpp turns this into
28 * typedef struct FormData_pg_operator
29 * ----------------
30 */
31CATALOG(pg_operator,2617,OperatorRelationId)
32{
33 Oid oid; /* oid */
34
35 /* name of operator */
36 NameData oprname;
37
38 /* OID of namespace containing this oper */
39 Oid oprnamespace BKI_DEFAULT(pg_catalog) BKI_LOOKUP(pg_namespace);
40
41 /* operator owner */
42 Oid oprowner BKI_DEFAULT(POSTGRES) BKI_LOOKUP(pg_authid);
43
44 /* 'l' for prefix or 'b' for infix */
45 char oprkind BKI_DEFAULT(b);
46
47 /* can be used in merge join? */
48 bool oprcanmerge BKI_DEFAULT(f);
49
50 /* can be used in hash join? */
51 bool oprcanhash BKI_DEFAULT(f);
52
53 /* left arg type, or 0 if prefix operator */
54 Oid oprleft BKI_LOOKUP_OPT(pg_type);
55
56 /* right arg type */
57 Oid oprright BKI_LOOKUP(pg_type);
58
59 /* result datatype; can be 0 in a "shell" operator */
60 Oid oprresult BKI_LOOKUP_OPT(pg_type);
61
62 /* OID of commutator oper, or 0 if none */
63 Oid oprcom BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_operator);
64
65 /* OID of negator oper, or 0 if none */
66 Oid oprnegate BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_operator);
67
68 /* OID of underlying function; can be 0 in a "shell" operator */
69 regproc oprcode BKI_LOOKUP_OPT(pg_proc);
70
71 /* OID of restriction estimator, or 0 */
72 regproc oprrest BKI_DEFAULT(-) BKI_LOOKUP_OPT(pg_proc);
73
74 /* OID of join estimator, or 0 */
75 regproc oprjoin BKI_DEFAULT(-) BKI_LOOKUP_OPT(pg_proc);
77
78/* ----------------
79 * Form_pg_operator corresponds to a pointer to a tuple with
80 * the format of pg_operator relation.
81 * ----------------
82 */
84
85DECLARE_UNIQUE_INDEX_PKEY(pg_operator_oid_index, 2688, OperatorOidIndexId, pg_operator, btree(oid oid_ops));
86DECLARE_UNIQUE_INDEX(pg_operator_oprname_l_r_n_index, 2689, OperatorNameNspIndexId, pg_operator, btree(oprname name_ops, oprleft oid_ops, oprright oid_ops, oprnamespace oid_ops));
87
88MAKE_SYSCACHE(OPEROID, pg_operator_oid_index, 32);
89MAKE_SYSCACHE(OPERNAMENSP, pg_operator_oprname_l_r_n_index, 256);
90
91extern Oid OperatorLookup(List *operatorName,
92 Oid leftObjectId,
93 Oid rightObjectId,
94 bool *defined);
95
96extern ObjectAddress OperatorCreate(const char *operatorName,
97 Oid operatorNamespace,
98 Oid leftTypeId,
99 Oid rightTypeId,
100 Oid procedureId,
101 List *commutatorName,
102 List *negatorName,
103 Oid restrictionId,
104 Oid joinId,
105 bool canMerge,
106 bool canHash);
107
109 bool makeExtensionDep,
110 bool isUpdate);
111
112extern void OperatorValidateParams(Oid leftTypeId,
113 Oid rightTypeId,
114 Oid operResultType,
115 bool hasCommutator,
116 bool hasNegator,
117 bool hasRestrictionSelectivity,
118 bool hasJoinSelectivity,
119 bool canMerge,
120 bool canHash);
121
122extern void OperatorUpd(Oid baseId, Oid commId, Oid negId, bool isDelete);
123
124#endif /* PG_OPERATOR_H */
Oid regproc
Definition: c.h:620
#define BKI_LOOKUP(catalog)
Definition: genbki.h:46
#define BKI_DEFAULT(value)
Definition: genbki.h:35
#define BKI_LOOKUP_OPT(catalog)
Definition: genbki.h:47
int b
Definition: isn.c:74
FormData_pg_operator
Definition: pg_operator.h:76
DECLARE_UNIQUE_INDEX_PKEY(pg_operator_oid_index, 2688, OperatorOidIndexId, pg_operator, btree(oid oid_ops))
ObjectAddress OperatorCreate(const char *operatorName, Oid operatorNamespace, Oid leftTypeId, Oid rightTypeId, Oid procedureId, List *commutatorName, List *negatorName, Oid restrictionId, Oid joinId, bool canMerge, bool canHash)
Definition: pg_operator.c:321
DECLARE_UNIQUE_INDEX(pg_operator_oprname_l_r_n_index, 2689, OperatorNameNspIndexId, pg_operator, btree(oprname name_ops, oprleft oid_ops, oprright oid_ops, oprnamespace oid_ops))
void OperatorValidateParams(Oid leftTypeId, Oid rightTypeId, Oid operResultType, bool hasCommutator, bool hasNegator, bool hasRestrictionSelectivity, bool hasJoinSelectivity, bool canMerge, bool canHash)
Definition: pg_operator.c:556
Oid OperatorLookup(List *operatorName, Oid leftObjectId, Oid rightObjectId, bool *defined)
Definition: pg_operator.c:164
FormData_pg_operator * Form_pg_operator
Definition: pg_operator.h:83
CATALOG(pg_operator, 2617, OperatorRelationId)
Definition: pg_operator.h:31
ObjectAddress makeOperatorDependencies(HeapTuple tuple, bool makeExtensionDep, bool isUpdate)
Definition: pg_operator.c:853
void OperatorUpd(Oid baseId, Oid commId, Oid negId, bool isDelete)
Definition: pg_operator.c:684
MAKE_SYSCACHE(OPEROID, pg_operator_oid_index, 32)
unsigned int Oid
Definition: postgres_ext.h:30
Definition: pg_list.h:54
Definition: c.h:712