mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-02-17 19:30:00 +08:00
Move strategy numbers to include/access/stratnum.h
For upcoming BRIN opclasses, it's convenient to have strategy numbers defined in a single place. Since there's nothing appropriate, create it. The StrategyNumber typedef now lives there, as well as existing strategy numbers for B-trees (from skey.h) and R-tree-and-friends (from gist.h). skey.h is forced to include stratnum.h because of the StrategyNumber typedef, but gist.h is not; extensions that currently rely on gist.h for rtree strategy numbers might need to add a new A few .c files can stop including skey.h and/or gist.h, which is a nice side benefit. Per discussion: https://www.postgresql.org/message-id/20150514232132.GZ2523@alvh.no-ip.org Authored by Emre Hasegeli and Álvaro. (It's not clear to me why bootscanner.l has any #include lines at all.)
This commit is contained in:
parent
1e98fa0bf8
commit
26df7066cc
@ -5,7 +5,7 @@
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#include "access/skey.h"
|
||||
#include "access/stratnum.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/bytea.h"
|
||||
#include "utils/cash.h"
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include <math.h>
|
||||
|
||||
#include "access/gist.h"
|
||||
#include "access/skey.h"
|
||||
#include "access/stratnum.h"
|
||||
#include "utils/array.h"
|
||||
#include "utils/builtins.h"
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include "postgres.h"
|
||||
|
||||
#include "access/gin.h"
|
||||
#include "access/skey.h"
|
||||
#include "access/stratnum.h"
|
||||
#include "catalog/pg_type.h"
|
||||
|
||||
#include "hstore.h"
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include "postgres.h"
|
||||
|
||||
#include "access/gist.h"
|
||||
#include "access/skey.h"
|
||||
#include "access/stratnum.h"
|
||||
#include "catalog/pg_type.h"
|
||||
#include "utils/pg_crc.h"
|
||||
|
||||
|
@ -4,8 +4,7 @@
|
||||
#include "postgres.h"
|
||||
|
||||
#include "access/gin.h"
|
||||
#include "access/gist.h"
|
||||
#include "access/skey.h"
|
||||
#include "access/stratnum.h"
|
||||
|
||||
#include "_int.h"
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include <limits.h>
|
||||
|
||||
#include "access/gist.h"
|
||||
#include "access/skey.h"
|
||||
#include "access/stratnum.h"
|
||||
|
||||
#include "_int.h"
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include "postgres.h"
|
||||
|
||||
#include "access/gist.h"
|
||||
#include "access/skey.h"
|
||||
#include "access/stratnum.h"
|
||||
|
||||
#include "_int.h"
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "postgres.h"
|
||||
|
||||
#include "access/gist.h"
|
||||
#include "access/skey.h"
|
||||
#include "access/stratnum.h"
|
||||
#include "crc32.h"
|
||||
#include "ltree.h"
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include "postgres.h"
|
||||
|
||||
#include "access/gist.h"
|
||||
#include "access/skey.h"
|
||||
#include "access/stratnum.h"
|
||||
#include "crc32.h"
|
||||
#include "ltree.h"
|
||||
|
||||
|
@ -6,7 +6,8 @@
|
||||
#include "trgm.h"
|
||||
|
||||
#include "access/gin.h"
|
||||
#include "access/skey.h"
|
||||
#include "access/stratnum.h"
|
||||
#include "fmgr.h"
|
||||
|
||||
|
||||
PG_FUNCTION_INFO_V1(gin_extract_trgm);
|
||||
|
@ -5,7 +5,8 @@
|
||||
|
||||
#include "trgm.h"
|
||||
|
||||
#include "access/skey.h"
|
||||
#include "access/stratnum.h"
|
||||
#include "fmgr.h"
|
||||
|
||||
|
||||
typedef struct
|
||||
|
@ -12,7 +12,8 @@
|
||||
#include <float.h>
|
||||
|
||||
#include "access/gist.h"
|
||||
#include "access/skey.h"
|
||||
#include "access/stratnum.h"
|
||||
#include "fmgr.h"
|
||||
|
||||
#include "segdata.h"
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "access/genam.h"
|
||||
#include "access/brin_internal.h"
|
||||
#include "access/brin_tuple.h"
|
||||
#include "access/skey.h"
|
||||
#include "access/stratnum.h"
|
||||
#include "catalog/pg_type.h"
|
||||
#include "catalog/pg_amop.h"
|
||||
#include "utils/datum.h"
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "postgres.h"
|
||||
|
||||
#include "access/gin.h"
|
||||
#include "access/skey.h"
|
||||
#include "access/stratnum.h"
|
||||
#include "utils/array.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/lsyscache.h"
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "postgres.h"
|
||||
|
||||
#include "access/gist.h"
|
||||
#include "access/skey.h"
|
||||
#include "access/stratnum.h"
|
||||
#include "utils/geo_decls.h"
|
||||
|
||||
|
||||
|
@ -15,8 +15,8 @@
|
||||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "access/gist.h" /* for RTree strategy numbers */
|
||||
#include "access/spgist.h"
|
||||
#include "access/stratnum.h"
|
||||
#include "catalog/pg_type.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/geo_decls.h"
|
||||
|
@ -15,8 +15,8 @@
|
||||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "access/gist.h" /* for RTree strategy numbers */
|
||||
#include "access/spgist.h"
|
||||
#include "access/stratnum.h"
|
||||
#include "catalog/pg_type.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/geo_decls.h"
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "access/attnum.h"
|
||||
#include "access/htup.h"
|
||||
#include "access/itup.h"
|
||||
#include "access/skey.h"
|
||||
#include "access/tupdesc.h"
|
||||
#include "access/xact.h"
|
||||
#include "bootstrap/bootstrap.h"
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "access/attnum.h"
|
||||
#include "access/htup.h"
|
||||
#include "access/itup.h"
|
||||
#include "access/skey.h"
|
||||
#include "access/tupdesc.h"
|
||||
#include "bootstrap/bootstrap.h"
|
||||
#include "catalog/pg_am.h"
|
||||
|
@ -16,7 +16,7 @@
|
||||
*/
|
||||
#include "postgres.h"
|
||||
|
||||
#include "access/skey.h"
|
||||
#include "access/stratnum.h"
|
||||
#include "catalog/pg_type.h"
|
||||
#include "nodes/makefuncs.h"
|
||||
#include "nodes/nodeFuncs.h"
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "access/skey.h"
|
||||
#include "access/stratnum.h"
|
||||
#include "access/sysattr.h"
|
||||
#include "catalog/pg_am.h"
|
||||
#include "catalog/pg_collation.h"
|
||||
|
@ -17,7 +17,7 @@
|
||||
*/
|
||||
#include "postgres.h"
|
||||
|
||||
#include "access/skey.h"
|
||||
#include "access/stratnum.h"
|
||||
#include "nodes/makefuncs.h"
|
||||
#include "nodes/nodeFuncs.h"
|
||||
#include "nodes/plannodes.h"
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "access/skey.h"
|
||||
#include "access/stratnum.h"
|
||||
#include "access/sysattr.h"
|
||||
#include "catalog/pg_class.h"
|
||||
#include "catalog/pg_operator.h"
|
||||
|
@ -1248,7 +1248,7 @@ list_member_strip(List *list, Expr *datum)
|
||||
* Define "operator implication tables" for btree operators ("strategies"),
|
||||
* and similar tables for refutation.
|
||||
*
|
||||
* The strategy numbers defined by btree indexes (see access/skey.h) are:
|
||||
* The strategy numbers defined by btree indexes (see access/stratnum.h) are:
|
||||
* 1 < 2 <= 3 = 4 >= 5 >
|
||||
* and in addition we use 6 to represent <>. <> is not a btree-indexable
|
||||
* operator, but we assume here that if an equality operator of a btree
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#include "access/gin.h"
|
||||
#include "access/hash.h"
|
||||
#include "access/skey.h"
|
||||
#include "access/stratnum.h"
|
||||
#include "catalog/pg_collation.h"
|
||||
#include "catalog/pg_type.h"
|
||||
#include "utils/builtins.h"
|
||||
|
@ -48,23 +48,23 @@
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include "access/gist.h"
|
||||
#include "access/skey.h"
|
||||
#include "access/stratnum.h"
|
||||
#include "utils/inet.h"
|
||||
|
||||
/*
|
||||
* Operator strategy numbers used in the GiST inet_ops opclass
|
||||
*/
|
||||
#define INETSTRAT_OVERLAPS 3
|
||||
#define INETSTRAT_EQ 18
|
||||
#define INETSTRAT_NE 19
|
||||
#define INETSTRAT_LT 20
|
||||
#define INETSTRAT_LE 21
|
||||
#define INETSTRAT_GT 22
|
||||
#define INETSTRAT_GE 23
|
||||
#define INETSTRAT_SUB 24
|
||||
#define INETSTRAT_SUBEQ 25
|
||||
#define INETSTRAT_SUP 26
|
||||
#define INETSTRAT_SUPEQ 27
|
||||
#define INETSTRAT_OVERLAPS RTOverlapStrategyNumber
|
||||
#define INETSTRAT_EQ RTEqualStrategyNumber
|
||||
#define INETSTRAT_NE RTNotEqualStrategyNumber
|
||||
#define INETSTRAT_LT RTLessStrategyNumber
|
||||
#define INETSTRAT_LE RTLessEqualStrategyNumber
|
||||
#define INETSTRAT_GT RTGreaterStrategyNumber
|
||||
#define INETSTRAT_GE RTGreaterEqualStrategyNumber
|
||||
#define INETSTRAT_SUB RTSubStrategyNumber
|
||||
#define INETSTRAT_SUBEQ RTSubOrEqualStrategyNumber
|
||||
#define INETSTRAT_SUP RTSuperStrategyNumber
|
||||
#define INETSTRAT_SUPEQ RTSuperOrEqualStrategyNumber
|
||||
|
||||
|
||||
/*
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "postgres.h"
|
||||
|
||||
#include "access/gist.h"
|
||||
#include "access/skey.h"
|
||||
#include "access/stratnum.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/datum.h"
|
||||
#include "utils/rangetypes.h"
|
||||
|
@ -37,7 +37,7 @@
|
||||
#include "postgres.h"
|
||||
|
||||
#include "access/spgist.h"
|
||||
#include "access/skey.h"
|
||||
#include "access/stratnum.h"
|
||||
#include "catalog/pg_type.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/datum.h"
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "postgres.h"
|
||||
|
||||
#include "access/gin.h"
|
||||
#include "access/skey.h"
|
||||
#include "access/stratnum.h"
|
||||
#include "miscadmin.h"
|
||||
#include "tsearch/ts_type.h"
|
||||
#include "tsearch/ts_utils.h"
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "access/skey.h"
|
||||
#include "access/stratnum.h"
|
||||
#include "access/gist.h"
|
||||
#include "tsearch/ts_utils.h"
|
||||
|
||||
|
@ -36,26 +36,6 @@
|
||||
#define GIST_FETCH_PROC 9
|
||||
#define GISTNProcs 9
|
||||
|
||||
/*
|
||||
* strategy numbers for GiST opclasses that want to implement the old
|
||||
* RTREE behavior.
|
||||
*/
|
||||
#define RTLeftStrategyNumber 1
|
||||
#define RTOverLeftStrategyNumber 2
|
||||
#define RTOverlapStrategyNumber 3
|
||||
#define RTOverRightStrategyNumber 4
|
||||
#define RTRightStrategyNumber 5
|
||||
#define RTSameStrategyNumber 6
|
||||
#define RTContainsStrategyNumber 7 /* for @> */
|
||||
#define RTContainedByStrategyNumber 8 /* for <@ */
|
||||
#define RTOverBelowStrategyNumber 9
|
||||
#define RTBelowStrategyNumber 10
|
||||
#define RTAboveStrategyNumber 11
|
||||
#define RTOverAboveStrategyNumber 12
|
||||
#define RTOldContainsStrategyNumber 13 /* for old spelling of @> */
|
||||
#define RTOldContainedByStrategyNumber 14 /* for old spelling of <@ */
|
||||
#define RTKNNSearchStrategyNumber 15
|
||||
|
||||
/*
|
||||
* Page opaque data in a GiST index page.
|
||||
*/
|
||||
|
@ -430,7 +430,7 @@ typedef struct xl_btree_newroot
|
||||
|
||||
|
||||
/*
|
||||
* Operator strategy numbers for B-tree have been moved to access/skey.h,
|
||||
* Operator strategy numbers for B-tree have been moved to access/stratnum.h,
|
||||
* because many places need to use them in ScanKeyInit() calls.
|
||||
*
|
||||
* The strategy numbers are chosen so that we can commute them by
|
||||
|
@ -15,31 +15,10 @@
|
||||
#define SKEY_H
|
||||
|
||||
#include "access/attnum.h"
|
||||
#include "access/stratnum.h"
|
||||
#include "fmgr.h"
|
||||
|
||||
|
||||
/*
|
||||
* Strategy numbers identify the semantics that particular operators have
|
||||
* with respect to particular operator classes. In some cases a strategy
|
||||
* subtype (an OID) is used as further information.
|
||||
*/
|
||||
typedef uint16 StrategyNumber;
|
||||
|
||||
#define InvalidStrategy ((StrategyNumber) 0)
|
||||
|
||||
/*
|
||||
* We define the strategy numbers for B-tree indexes here, to avoid having
|
||||
* to import access/nbtree.h into a lot of places that shouldn't need it.
|
||||
*/
|
||||
#define BTLessStrategyNumber 1
|
||||
#define BTLessEqualStrategyNumber 2
|
||||
#define BTEqualStrategyNumber 3
|
||||
#define BTGreaterEqualStrategyNumber 4
|
||||
#define BTGreaterStrategyNumber 5
|
||||
|
||||
#define BTMaxStrategyNumber 5
|
||||
|
||||
|
||||
/*
|
||||
* A ScanKey represents the application of a comparison operator between
|
||||
* a table or index column and a constant. When it's part of an array of
|
||||
|
75
src/include/access/stratnum.h
Normal file
75
src/include/access/stratnum.h
Normal file
@ -0,0 +1,75 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* stratnum.h
|
||||
* POSTGRES strategy number definitions.
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/access/stratnum.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef STRATNUM_H
|
||||
#define STRATNUM_H
|
||||
|
||||
/*
|
||||
* Strategy numbers identify the semantics that particular operators have
|
||||
* with respect to particular operator classes. In some cases a strategy
|
||||
* subtype (an OID) is used as further information.
|
||||
*/
|
||||
typedef uint16 StrategyNumber;
|
||||
|
||||
#define InvalidStrategy ((StrategyNumber) 0)
|
||||
|
||||
/*
|
||||
* Strategy numbers for B-tree indexes.
|
||||
*/
|
||||
#define BTLessStrategyNumber 1
|
||||
#define BTLessEqualStrategyNumber 2
|
||||
#define BTEqualStrategyNumber 3
|
||||
#define BTGreaterEqualStrategyNumber 4
|
||||
#define BTGreaterStrategyNumber 5
|
||||
|
||||
#define BTMaxStrategyNumber 5
|
||||
|
||||
|
||||
/*
|
||||
* Strategy numbers common to (some) GiST, SP-GiST and BRIN opclasses.
|
||||
*
|
||||
* The first few of these come from the R-Tree indexing method (hence the
|
||||
* names); the others have been added over time as they have been needed.
|
||||
*/
|
||||
#define RTLeftStrategyNumber 1 /* for << */
|
||||
#define RTOverLeftStrategyNumber 2 /* for &< */
|
||||
#define RTOverlapStrategyNumber 3 /* for && */
|
||||
#define RTOverRightStrategyNumber 4 /* for &> */
|
||||
#define RTRightStrategyNumber 5 /* for >> */
|
||||
#define RTSameStrategyNumber 6 /* for ~= */
|
||||
#define RTContainsStrategyNumber 7 /* for @> */
|
||||
#define RTContainedByStrategyNumber 8 /* for <@ */
|
||||
#define RTOverBelowStrategyNumber 9 /* for &<| */
|
||||
#define RTBelowStrategyNumber 10 /* for <<| */
|
||||
#define RTAboveStrategyNumber 11 /* for |>> */
|
||||
#define RTOverAboveStrategyNumber 12 /* for |&> */
|
||||
#define RTOldContainsStrategyNumber 13 /* for old spelling of @> */
|
||||
#define RTOldContainedByStrategyNumber 14 /* for old spelling of <@ */
|
||||
#define RTKNNSearchStrategyNumber 15 /* for <-> (distance) */
|
||||
#define RTContainsElemStrategyNumber 16 /* for range types @> elem */
|
||||
#define RTAdjacentStrategyNumber 17 /* for -|- */
|
||||
#define RTEqualStrategyNumber 18 /* for = */
|
||||
#define RTNotEqualStrategyNumber 19 /* for != */
|
||||
#define RTLessStrategyNumber 20 /* for < */
|
||||
#define RTLessEqualStrategyNumber 21 /* for <= */
|
||||
#define RTGreaterStrategyNumber 22 /* for > */
|
||||
#define RTGreaterEqualStrategyNumber 23 /* for >= */
|
||||
#define RTSubStrategyNumber 24 /* for inet >> */
|
||||
#define RTSubOrEqualStrategyNumber 25 /* for inet <<= */
|
||||
#define RTSuperStrategyNumber 26 /* for inet << */
|
||||
#define RTSuperOrEqualStrategyNumber 27 /* for inet >>= */
|
||||
|
||||
#define RTMaxStrategyNumber 27
|
||||
|
||||
|
||||
#endif /* STRATNUM_H */
|
@ -77,16 +77,16 @@ typedef struct
|
||||
|
||||
/* Operator strategy numbers used in the GiST and SP-GiST range opclasses */
|
||||
/* Numbers are chosen to match up operator names with existing usages */
|
||||
#define RANGESTRAT_BEFORE 1
|
||||
#define RANGESTRAT_OVERLEFT 2
|
||||
#define RANGESTRAT_OVERLAPS 3
|
||||
#define RANGESTRAT_OVERRIGHT 4
|
||||
#define RANGESTRAT_AFTER 5
|
||||
#define RANGESTRAT_ADJACENT 6
|
||||
#define RANGESTRAT_CONTAINS 7
|
||||
#define RANGESTRAT_CONTAINED_BY 8
|
||||
#define RANGESTRAT_CONTAINS_ELEM 16
|
||||
#define RANGESTRAT_EQ 18
|
||||
#define RANGESTRAT_BEFORE RTLeftStrategyNumber
|
||||
#define RANGESTRAT_OVERLEFT RTOverLeftStrategyNumber
|
||||
#define RANGESTRAT_OVERLAPS RTOverlapStrategyNumber
|
||||
#define RANGESTRAT_OVERRIGHT RTOverRightStrategyNumber
|
||||
#define RANGESTRAT_AFTER RTRightStrategyNumber
|
||||
#define RANGESTRAT_ADJACENT RTSameStrategyNumber
|
||||
#define RANGESTRAT_CONTAINS RTContainsStrategyNumber
|
||||
#define RANGESTRAT_CONTAINED_BY RTContainedByStrategyNumber
|
||||
#define RANGESTRAT_CONTAINS_ELEM RTContainsElemStrategyNumber
|
||||
#define RANGESTRAT_EQ RTEqualStrategyNumber
|
||||
|
||||
/*
|
||||
* prototypes for functions defined in rangetypes.c
|
||||
|
Loading…
Reference in New Issue
Block a user