mirror of
https://github.com/postgres/postgres.git
synced 2025-11-06 07:49:08 +03:00
Replace functional-index facility with expressional indexes. Any column
of an index can now be a computed expression instead of a simple variable. Restrictions on expressions are the same as for predicates (only immutable functions, no sub-selects). This fixes problems recently introduced with inlining SQL functions, because the inlining transformation is applied to both expression trees so the planner can still match them up. Along the way, improve efficiency of handling index predicates (both predicates and index expressions are now cached by the relcache) and fix 7.3 oversight that didn't record dependencies of predicate expressions.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: parsenodes.h,v 1.237 2003/05/02 20:54:36 tgl Exp $
|
||||
* $Id: parsenodes.h,v 1.238 2003/05/28 16:04:02 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -353,17 +353,15 @@ typedef struct ColumnDef
|
||||
/*
|
||||
* IndexElem - index parameters (used in CREATE INDEX)
|
||||
*
|
||||
* For a plain index, each 'name' is an attribute name in the heap relation;
|
||||
* 'funcname' and 'args' are NIL. For a functional index, only one IndexElem
|
||||
* is allowed. It has name = NULL, funcname = name of function and args =
|
||||
* list of attribute names that are the function's arguments.
|
||||
* For a plain index attribute, 'name' is the name of the table column to
|
||||
* index, and 'expr' is NULL. For an index expression, 'name' is NULL and
|
||||
* 'expr' is the expression tree.
|
||||
*/
|
||||
typedef struct IndexElem
|
||||
{
|
||||
NodeTag type;
|
||||
char *name; /* name of attribute to index, or NULL */
|
||||
List *funcname; /* qualified name of function */
|
||||
List *args; /* list of names of function arguments */
|
||||
Node *expr; /* expression to index, or NULL */
|
||||
List *opclass; /* name of desired opclass; NIL = default */
|
||||
} IndexElem;
|
||||
|
||||
@@ -1271,8 +1269,8 @@ typedef struct IndexStmt
|
||||
char *accessMethod; /* name of access method (eg. btree) */
|
||||
List *indexParams; /* a list of IndexElem */
|
||||
Node *whereClause; /* qualification (partial-index predicate) */
|
||||
List *rangetable; /* range table for qual, filled in by
|
||||
* transformStmt() */
|
||||
List *rangetable; /* range table for qual and/or expressions,
|
||||
* filled in by transformStmt() */
|
||||
bool unique; /* is index unique? */
|
||||
bool primary; /* is index on primary key? */
|
||||
bool isconstraint; /* is it from a CONSTRAINT clause? */
|
||||
|
||||
Reference in New Issue
Block a user