codekingpro/portable-devtools
114k
1/*-------------------------------------------------------------------------2 *3 * pg_amop.h4 * definition of the "access method operator" system catalog (pg_amop)5 *6 * The amop table identifies the operators associated with each index operator7 * family and operator class (classes are subsets of families). An associated8 * operator can be either a search operator or an ordering operator, as9 * identified by amoppurpose.10 *11 * The primary key for this table is <amopfamily, amoplefttype, amoprighttype,12 * amopstrategy>. amoplefttype and amoprighttype are just copies of the13 * operator's oprleft/oprright, ie its declared input data types. The14 * "default" operators for a particular opclass within the family are those15 * with amoplefttype = amoprighttype = opclass's opcintype. An opfamily may16 * also contain other operators, typically cross-data-type operators. All the17 * operators within a family are supposed to be compatible, in a way that is18 * defined by each individual index AM.19 *20 * We also keep a unique index on <amopopr, amoppurpose, amopfamily>, so that21 * we can use a syscache to quickly answer questions of the form "is this22 * operator in this opfamily, and if so what are its semantics with respect to23 * the family?" This implies that the same operator cannot be listed for24 * multiple strategy numbers within a single opfamily, with the exception that25 * it's possible to list it for both search and ordering purposes (with26 * different strategy numbers for the two purposes).27 *28 * amopmethod is a copy of the owning opfamily's opfmethod field. This is an29 * intentional denormalization of the catalogs to buy lookup speed.30 *31 *32 * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group33 * Portions Copyright (c) 1994, Regents of the University of California34 *35 * src/include/catalog/pg_amop.h36 *37 * NOTES38 * The Catalog.pm module reads this file and derives schema39 * information.40 *41 *-------------------------------------------------------------------------42 */43#ifndef PG_AMOP_H44#define PG_AMOP_H45 46#include "catalog/genbki.h"47#include "catalog/pg_amop_d.h"48 49/* ----------------50 * pg_amop definition. cpp turns this into51 * typedef struct FormData_pg_amop52 * ----------------53 */54CATALOG(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_OPT(pg_opfamily);81} FormData_pg_amop;82 83/* ----------------84 * Form_pg_amop corresponds to a pointer to a tuple with85 * the format of pg_amop relation.86 * ----------------87 */88typedef FormData_pg_amop *Form_pg_amop;89 90DECLARE_UNIQUE_INDEX(pg_amop_fam_strat_index, 2653, AccessMethodStrategyIndexId, on pg_amop using btree(amopfamily oid_ops, amoplefttype oid_ops, amoprighttype oid_ops, amopstrategy int2_ops));91DECLARE_UNIQUE_INDEX(pg_amop_opr_fam_index, 2654, AccessMethodOperatorIndexId, on pg_amop using btree(amopopr oid_ops, amoppurpose char_ops, amopfamily oid_ops));92DECLARE_UNIQUE_INDEX_PKEY(pg_amop_oid_index, 2756, AccessMethodOperatorOidIndexId, on pg_amop using btree(oid oid_ops));93 94#ifdef EXPOSE_TO_CLIENT_CODE95 96/* allowed values of amoppurpose: */97#define AMOP_SEARCH 's' /* operator is for search */98#define AMOP_ORDER 'o' /* operator is for ordering */99 100#endif /* EXPOSE_TO_CLIENT_CODE */101 102#endif /* PG_AMOP_H */103 