PostgreSQL Source Code  git master
pg_amop.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * pg_amop.h
4  * definition of the "access method operator" system catalog (pg_amop)
5  *
6  * The amop table identifies the operators associated with each index operator
7  * family and operator class (classes are subsets of families). An associated
8  * operator can be either a search operator or an ordering operator, as
9  * identified by amoppurpose.
10  *
11  * The primary key for this table is <amopfamily, amoplefttype, amoprighttype,
12  * amopstrategy>. amoplefttype and amoprighttype are just copies of the
13  * operator's oprleft/oprright, ie its declared input data types. The
14  * "default" operators for a particular opclass within the family are those
15  * with amoplefttype = amoprighttype = opclass's opcintype. An opfamily may
16  * also contain other operators, typically cross-data-type operators. All the
17  * operators within a family are supposed to be compatible, in a way that is
18  * defined by each individual index AM.
19  *
20  * We also keep a unique index on <amopopr, amoppurpose, amopfamily>, so that
21  * we can use a syscache to quickly answer questions of the form "is this
22  * operator in this opfamily, and if so what are its semantics with respect to
23  * the family?" This implies that the same operator cannot be listed for
24  * multiple strategy numbers within a single opfamily, with the exception that
25  * it's possible to list it for both search and ordering purposes (with
26  * different strategy numbers for the two purposes).
27  *
28  * amopmethod is a copy of the owning opfamily's opfmethod field. This is an
29  * intentional denormalization of the catalogs to buy lookup speed.
30  *
31  *
32  * Portions Copyright (c) 1996-2018, PostgreSQL Global Development Group
33  * Portions Copyright (c) 1994, Regents of the University of California
34  *
35  * src/include/catalog/pg_amop.h
36  *
37  * NOTES
38  * The Catalog.pm module reads this file and derives schema
39  * information.
40  *
41  *-------------------------------------------------------------------------
42  */
43 #ifndef PG_AMOP_H
44 #define PG_AMOP_H
45 
46 #include "catalog/genbki.h"
47 #include "catalog/pg_amop_d.h"
48 
49 /* ----------------
50  * pg_amop definition. cpp turns this into
51  * typedef struct FormData_pg_amop
52  * ----------------
53  */
54 CATALOG(pg_amop,2602,AccessMethodOperatorRelationId)
55 {
56  /* the index opfamily this entry is for */
57  Oid amopfamily BKI_LOOKUP(pg_opfamily);
58 
59  /* operator's left input data type */
60  Oid amoplefttype BKI_LOOKUP(pg_type);
61 
62  /* operator's right input data type */
63  Oid amoprighttype BKI_LOOKUP(pg_type);
64 
65  /* operator strategy number */
66  int16 amopstrategy;
67 
68  /* is operator for 's'earch or 'o'rdering? */
69  char amoppurpose BKI_DEFAULT(s);
70 
71  /* the operator's pg_operator OID */
72  Oid amopopr BKI_LOOKUP(pg_operator);
73 
74  /* the index access method this entry is for */
75  Oid amopmethod BKI_LOOKUP(pg_am);
76 
77  /* ordering opfamily OID, or 0 if search op */
78  Oid amopsortfamily BKI_DEFAULT(0) BKI_LOOKUP(pg_opfamily);
80 
81 /* ----------------
82  * Form_pg_amop corresponds to a pointer to a tuple with
83  * the format of pg_amop relation.
84  * ----------------
85  */
87 
88 #ifdef EXPOSE_TO_CLIENT_CODE
89 
90 /* allowed values of amoppurpose: */
91 #define AMOP_SEARCH 's' /* operator is for search */
92 #define AMOP_ORDER 'o' /* operator is for ordering */
93 
94 #endif /* EXPOSE_TO_CLIENT_CODE */
95 
96 #endif /* PG_AMOP_H */
signed short int16
Definition: c.h:312
unsigned int Oid
Definition: postgres_ext.h:31
#define BKI_DEFAULT(value)
Definition: genbki.h:36
FormData_pg_amop
Definition: pg_amop.h:79
#define BKI_LOOKUP(catalog)
Definition: genbki.h:38
CATALOG(pg_amop, 2602, AccessMethodOperatorRelationId)
Definition: pg_amop.h:54
FormData_pg_amop * Form_pg_amop
Definition: pg_amop.h:86