| 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-2019, 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 | Oid			oid;			/* oid */ | 
|---|
| 57 |  | 
|---|
| 58 | /* the index opfamily this entry is for */ | 
|---|
| 59 | Oid			amopfamily BKI_LOOKUP(pg_opfamily); | 
|---|
| 60 |  | 
|---|
| 61 | /* operator's left input data type */ | 
|---|
| 62 | Oid			amoplefttype BKI_LOOKUP(pg_type); | 
|---|
| 63 |  | 
|---|
| 64 | /* operator's right input data type */ | 
|---|
| 65 | Oid			amoprighttype BKI_LOOKUP(pg_type); | 
|---|
| 66 |  | 
|---|
| 67 | /* operator strategy number */ | 
|---|
| 68 | int16		amopstrategy; | 
|---|
| 69 |  | 
|---|
| 70 | /* is operator for 's'earch or 'o'rdering? */ | 
|---|
| 71 | char		amoppurpose BKI_DEFAULT(s); | 
|---|
| 72 |  | 
|---|
| 73 | /* the operator's pg_operator OID */ | 
|---|
| 74 | Oid			amopopr BKI_LOOKUP(pg_operator); | 
|---|
| 75 |  | 
|---|
| 76 | /* the index access method this entry is for */ | 
|---|
| 77 | Oid			amopmethod BKI_LOOKUP(pg_am); | 
|---|
| 78 |  | 
|---|
| 79 | /* ordering opfamily OID, or 0 if search op */ | 
|---|
| 80 | Oid			amopsortfamily BKI_DEFAULT(0) BKI_LOOKUP(pg_opfamily); | 
|---|
| 81 | } FormData_pg_amop; | 
|---|
| 82 |  | 
|---|
| 83 | /* ---------------- | 
|---|
| 84 | *		Form_pg_amop corresponds to a pointer to a tuple with | 
|---|
| 85 | *		the format of pg_amop relation. | 
|---|
| 86 | * ---------------- | 
|---|
| 87 | */ | 
|---|
| 88 | typedef FormData_pg_amop *Form_pg_amop; | 
|---|
| 89 |  | 
|---|
| 90 | #ifdef EXPOSE_TO_CLIENT_CODE | 
|---|
| 91 |  | 
|---|
| 92 | /* allowed values of amoppurpose: */ | 
|---|
| 93 | #define AMOP_SEARCH		's'		/* operator is for search */ | 
|---|
| 94 | #define AMOP_ORDER		'o'		/* operator is for ordering */ | 
|---|
| 95 |  | 
|---|
| 96 | #endif							/* EXPOSE_TO_CLIENT_CODE */ | 
|---|
| 97 |  | 
|---|
| 98 | #endif							/* PG_AMOP_H */ | 
|---|
| 99 |  | 
|---|