mirror of
https://github.com/postgres/postgres.git
synced 2025-11-10 17:42:29 +03:00
Partial indexes work again, courtesy of Martijn van Oosterhout.
Note: I didn't force an initdb, figuring that one today was enough. However, there is a new function in pg_proc.h, and pg_dump won't be able to dump partial indexes until you add that function.
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.192 2001/07/04 17:36:54 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.193 2001/07/16 05:06:58 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -45,7 +45,6 @@ static Query *transformStmt(ParseState *pstate, Node *stmt);
|
||||
static Query *transformDeleteStmt(ParseState *pstate, DeleteStmt *stmt);
|
||||
static Query *transformInsertStmt(ParseState *pstate, InsertStmt *stmt);
|
||||
static Query *transformIndexStmt(ParseState *pstate, IndexStmt *stmt);
|
||||
static Query *transformExtendStmt(ParseState *pstate, ExtendStmt *stmt);
|
||||
static Query *transformRuleStmt(ParseState *query, RuleStmt *stmt);
|
||||
static Query *transformSelectStmt(ParseState *pstate, SelectStmt *stmt);
|
||||
static Query *transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt);
|
||||
@@ -148,10 +147,6 @@ transformStmt(ParseState *pstate, Node *parseTree)
|
||||
result = transformIndexStmt(pstate, (IndexStmt *) parseTree);
|
||||
break;
|
||||
|
||||
case T_ExtendStmt:
|
||||
result = transformExtendStmt(pstate, (ExtendStmt *) parseTree);
|
||||
break;
|
||||
|
||||
case T_RuleStmt:
|
||||
result = transformRuleStmt(pstate, (RuleStmt *) parseTree);
|
||||
break;
|
||||
@@ -1630,15 +1625,30 @@ static Query *
|
||||
transformIndexStmt(ParseState *pstate, IndexStmt *stmt)
|
||||
{
|
||||
Query *qry;
|
||||
RangeTblEntry *rte;
|
||||
|
||||
qry = makeNode(Query);
|
||||
qry->commandType = CMD_UTILITY;
|
||||
|
||||
/* take care of the where clause */
|
||||
stmt->whereClause = transformWhereClause(pstate, stmt->whereClause);
|
||||
if (stmt->whereClause)
|
||||
{
|
||||
/*
|
||||
* Put the parent table into the rtable so that the WHERE clause can
|
||||
* refer to its fields without qualification. Note that this only
|
||||
* works if the parent table already exists --- so we can't easily
|
||||
* support predicates on indexes created implicitly by CREATE TABLE.
|
||||
* Fortunately, that's not necessary.
|
||||
*/
|
||||
rte = addRangeTableEntry(pstate, stmt->relname, NULL, false, true);
|
||||
|
||||
/* no to join list, yes to namespace */
|
||||
addRTEtoQuery(pstate, rte, false, true);
|
||||
|
||||
stmt->whereClause = transformWhereClause(pstate, stmt->whereClause);
|
||||
}
|
||||
|
||||
qry->hasSubLinks = pstate->p_hasSubLinks;
|
||||
|
||||
stmt->rangetable = pstate->p_rtable;
|
||||
|
||||
qry->utilityStmt = (Node *) stmt;
|
||||
@@ -1646,30 +1656,6 @@ transformIndexStmt(ParseState *pstate, IndexStmt *stmt)
|
||||
return qry;
|
||||
}
|
||||
|
||||
/*
|
||||
* transformExtendStmt -
|
||||
* transform the qualifications of the Extend Index Statement
|
||||
*
|
||||
*/
|
||||
static Query *
|
||||
transformExtendStmt(ParseState *pstate, ExtendStmt *stmt)
|
||||
{
|
||||
Query *qry;
|
||||
|
||||
qry = makeNode(Query);
|
||||
qry->commandType = CMD_UTILITY;
|
||||
|
||||
/* take care of the where clause */
|
||||
stmt->whereClause = transformWhereClause(pstate, stmt->whereClause);
|
||||
|
||||
qry->hasSubLinks = pstate->p_hasSubLinks;
|
||||
|
||||
stmt->rangetable = pstate->p_rtable;
|
||||
|
||||
qry->utilityStmt = (Node *) stmt;
|
||||
return qry;
|
||||
}
|
||||
|
||||
/*
|
||||
* transformRuleStmt -
|
||||
* transform a Create Rule Statement. The actions is a list of parse
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.236 2001/07/12 18:02:59 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.237 2001/07/16 05:06:58 tgl Exp $
|
||||
*
|
||||
* HISTORY
|
||||
* AUTHOR DATE MAJOR EVENT
|
||||
@@ -135,7 +135,7 @@ static void doNegateFloat(Value *v);
|
||||
CreateSchemaStmt, CreateSeqStmt, CreateStmt, CreateTrigStmt,
|
||||
CreateUserStmt, CreatedbStmt, CursorStmt, DefineStmt, DeleteStmt,
|
||||
DropGroupStmt, DropPLangStmt, DropSchemaStmt, DropStmt, DropTrigStmt,
|
||||
DropUserStmt, DropdbStmt, ExplainStmt, ExtendStmt, FetchStmt,
|
||||
DropUserStmt, DropdbStmt, ExplainStmt, FetchStmt,
|
||||
GrantStmt, IndexStmt, InsertStmt, ListenStmt, LoadStmt, LockStmt,
|
||||
NotifyStmt, OptimizableStmt, ProcedureStmt, ReindexStmt,
|
||||
RemoveAggrStmt, RemoveFuncStmt, RemoveOperStmt,
|
||||
@@ -345,7 +345,7 @@ static void doNegateFloat(Value *v);
|
||||
BACKWARD, BEFORE, BINARY, BIT,
|
||||
CACHE, CHECKPOINT, CLUSTER, COMMENT, COPY, CREATEDB, CREATEUSER, CYCLE,
|
||||
DATABASE, DELIMITERS, DO,
|
||||
EACH, ENCODING, EXCLUSIVE, EXPLAIN, EXTEND,
|
||||
EACH, ENCODING, EXCLUSIVE, EXPLAIN,
|
||||
FORCE, FORWARD, FUNCTION, HANDLER,
|
||||
ILIKE, INCREMENT, INDEX, INHERITS, INSTEAD, ISNULL,
|
||||
LANCOMPILER, LIMIT, LISTEN, LOAD, LOCATION, LOCK_P,
|
||||
@@ -450,7 +450,6 @@ stmt : AlterSchemaStmt
|
||||
| DropPLangStmt
|
||||
| DropTrigStmt
|
||||
| DropUserStmt
|
||||
| ExtendStmt
|
||||
| ExplainStmt
|
||||
| FetchStmt
|
||||
| GrantStmt
|
||||
@@ -2392,14 +2391,14 @@ RevokeStmt: REVOKE privileges ON opt_table relation_name_list FROM grantee_list
|
||||
*
|
||||
* QUERY:
|
||||
* create index <indexname> on <relname>
|
||||
* using <access> "(" (<col> with <op>)+ ")" [with
|
||||
* <target_list>]
|
||||
* [ using <access> ] "(" (<col> with <op>)+ ")"
|
||||
* [ with <parameters> ]
|
||||
* [ where <predicate> ]
|
||||
*
|
||||
* [where <qual>] is not supported anymore
|
||||
*****************************************************************************/
|
||||
|
||||
IndexStmt: CREATE index_opt_unique INDEX index_name ON relation_name
|
||||
access_method_clause '(' index_params ')' opt_with
|
||||
access_method_clause '(' index_params ')' opt_with where_clause
|
||||
{
|
||||
IndexStmt *n = makeNode(IndexStmt);
|
||||
n->unique = $2;
|
||||
@@ -2408,7 +2407,7 @@ IndexStmt: CREATE index_opt_unique INDEX index_name ON relation_name
|
||||
n->accessMethod = $7;
|
||||
n->indexParams = $9;
|
||||
n->withClause = $11;
|
||||
n->whereClause = NULL;
|
||||
n->whereClause = $12;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
;
|
||||
@@ -2471,22 +2470,6 @@ opt_class: class
|
||||
;
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* QUERY:
|
||||
* extend index <indexname> [where <qual>]
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
ExtendStmt: EXTEND INDEX index_name where_clause
|
||||
{
|
||||
ExtendStmt *n = makeNode(ExtendStmt);
|
||||
n->idxname = $3;
|
||||
n->whereClause = $4;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
;
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* QUERY:
|
||||
@@ -5775,7 +5758,6 @@ ColLabel: ColId { $$ = $1; }
|
||||
| EXCEPT { $$ = "except"; }
|
||||
| EXISTS { $$ = "exists"; }
|
||||
| EXPLAIN { $$ = "explain"; }
|
||||
| EXTEND { $$ = "extend"; }
|
||||
| EXTRACT { $$ = "extract"; }
|
||||
| FALSE_P { $$ = "false"; }
|
||||
| FLOAT { $$ = "float"; }
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.93 2001/06/19 22:39:11 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.94 2001/07/16 05:06:58 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -109,7 +109,6 @@ static ScanKeyword ScanKeywords[] = {
|
||||
{"execute", EXECUTE},
|
||||
{"exists", EXISTS},
|
||||
{"explain", EXPLAIN},
|
||||
{"extend", EXTEND},
|
||||
{"extract", EXTRACT},
|
||||
{"false", FALSE_P},
|
||||
{"fetch", FETCH},
|
||||
|
||||
Reference in New Issue
Block a user