1 /*-------------------------------------------------------------------------
4 * definition of the "operator" system catalog (pg_operator)
7 * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
10 * src/include/catalog/pg_operator.h
13 * The Catalog.pm module reads this file and derives schema
16 *-------------------------------------------------------------------------
21 #include "catalog/genbki.h"
22 #include "catalog/objectaddress.h"
23 #include "catalog/pg_operator_d.h" /* IWYU pragma: export */
24 #include "nodes/pg_list.h"
27 * pg_operator definition. cpp turns this into
28 * typedef struct FormData_pg_operator
31 CATALOG(pg_operator
,2617,OperatorRelationId
)
35 /* name of operator */
38 /* OID of namespace containing this oper */
39 Oid oprnamespace
BKI_DEFAULT(pg_catalog
) BKI_LOOKUP(pg_namespace
);
42 Oid oprowner
BKI_DEFAULT(POSTGRES
) BKI_LOOKUP(pg_authid
);
44 /* 'l' for prefix or 'b' for infix */
45 char oprkind
BKI_DEFAULT(b
);
47 /* can be used in merge join? */
48 bool oprcanmerge
BKI_DEFAULT(f
);
50 /* can be used in hash join? */
51 bool oprcanhash
BKI_DEFAULT(f
);
53 /* left arg type, or 0 if prefix operator */
54 Oid oprleft
BKI_LOOKUP_OPT(pg_type
);
57 Oid oprright
BKI_LOOKUP(pg_type
);
59 /* result datatype; can be 0 in a "shell" operator */
60 Oid oprresult
BKI_LOOKUP_OPT(pg_type
);
62 /* OID of commutator oper, or 0 if none */
63 Oid oprcom
BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_operator
);
65 /* OID of negator oper, or 0 if none */
66 Oid oprnegate
BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_operator
);
68 /* OID of underlying function; can be 0 in a "shell" operator */
69 regproc oprcode
BKI_LOOKUP_OPT(pg_proc
);
71 /* OID of restriction estimator, or 0 */
72 regproc oprrest
BKI_DEFAULT(-) BKI_LOOKUP_OPT(pg_proc
);
74 /* OID of join estimator, or 0 */
75 regproc oprjoin
BKI_DEFAULT(-) BKI_LOOKUP_OPT(pg_proc
);
76 } FormData_pg_operator
;
79 * Form_pg_operator corresponds to a pointer to a tuple with
80 * the format of pg_operator relation.
83 typedef FormData_pg_operator
*Form_pg_operator
;
85 DECLARE_UNIQUE_INDEX_PKEY(pg_operator_oid_index
, 2688, OperatorOidIndexId
, pg_operator
, btree(oid oid_ops
));
86 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
));
88 MAKE_SYSCACHE(OPEROID
, pg_operator_oid_index
, 32);
89 MAKE_SYSCACHE(OPERNAMENSP
, pg_operator_oprname_l_r_n_index
, 256);
91 extern Oid
OperatorLookup(List
*operatorName
,
96 extern ObjectAddress
OperatorCreate(const char *operatorName
,
97 Oid operatorNamespace
,
101 List
*commutatorName
,
108 extern ObjectAddress
makeOperatorDependencies(HeapTuple tuple
,
109 bool makeExtensionDep
,
112 extern void OperatorValidateParams(Oid leftTypeId
,
117 bool hasRestrictionSelectivity
,
118 bool hasJoinSelectivity
,
122 extern void OperatorUpd(Oid baseId
, Oid commId
, Oid negId
, bool isDelete
);
124 #endif /* PG_OPERATOR_H */