1 /*-------------------------------------------------------------------------
2  *
3  * pg_operator.h
4  *	  definition of the "operator" system catalog (pg_operator)
5  *
6  *
7  * Portions Copyright (c) 1996-2018, 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 	/* name of operator */
35 	NameData	oprname;
36 
37 	/* OID of namespace containing this oper */
38 	Oid			oprnamespace BKI_DEFAULT(PGNSP);
39 
40 	/* operator owner */
41 	Oid			oprowner BKI_DEFAULT(PGUID);
42 
43 	/* 'l', 'r', or 'b' */
44 	char		oprkind BKI_DEFAULT(b);
45 
46 	/* can be used in merge join? */
47 	bool		oprcanmerge BKI_DEFAULT(f);
48 
49 	/* can be used in hash join? */
50 	bool		oprcanhash BKI_DEFAULT(f);
51 
52 	/* left arg type, or 0 if 'l' oprkind */
53 	Oid			oprleft BKI_LOOKUP(pg_type);
54 
55 	/* right arg type, or 0 if 'r' oprkind */
56 	Oid			oprright BKI_LOOKUP(pg_type);
57 
58 	/* result datatype */
59 	Oid			oprresult BKI_LOOKUP(pg_type);
60 
61 	/* OID of commutator oper, or 0 if none */
62 	Oid			oprcom BKI_DEFAULT(0) BKI_LOOKUP(pg_operator);
63 
64 	/* OID of negator oper, or 0 if none */
65 	Oid			oprnegate BKI_DEFAULT(0) BKI_LOOKUP(pg_operator);
66 
67 	/* OID of underlying function */
68 	regproc		oprcode BKI_LOOKUP(pg_proc);
69 
70 	/* OID of restriction estimator, or 0 */
71 	regproc		oprrest BKI_DEFAULT(-) BKI_LOOKUP(pg_proc);
72 
73 	/* OID of join estimator, or 0 */
74 	regproc		oprjoin BKI_DEFAULT(-) BKI_LOOKUP(pg_proc);
75 } FormData_pg_operator;
76 
77 /* ----------------
78  *		Form_pg_operator corresponds to a pointer to a tuple with
79  *		the format of pg_operator relation.
80  * ----------------
81  */
82 typedef FormData_pg_operator *Form_pg_operator;
83 
84 
85 extern ObjectAddress OperatorCreate(const char *operatorName,
86 			   Oid operatorNamespace,
87 			   Oid leftTypeId,
88 			   Oid rightTypeId,
89 			   Oid procedureId,
90 			   List *commutatorName,
91 			   List *negatorName,
92 			   Oid restrictionId,
93 			   Oid joinId,
94 			   bool canMerge,
95 			   bool canHash);
96 
97 extern ObjectAddress makeOperatorDependencies(HeapTuple tuple, bool isUpdate);
98 
99 extern void OperatorUpd(Oid baseId, Oid commId, Oid negId, bool isDelete);
100 
101 #endif							/* PG_OPERATOR_H */
102