aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/parser')
-rw-r--r--src/backend/parser/analyze.c48
-rw-r--r--src/backend/parser/gram.y34
-rw-r--r--src/backend/parser/keywords.c3
3 files changed, 26 insertions, 59 deletions
diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c
index 9d6dfeb69a7..186fa124507 100644
--- a/src/backend/parser/analyze.c
+++ b/src/backend/parser/analyze.c
@@ -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,43 +1625,34 @@ 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);
-
- qry->hasSubLinks = pstate->p_hasSubLinks;
-
- stmt->rangetable = pstate->p_rtable;
-
- qry->utilityStmt = (Node *) stmt;
-
- return qry;
-}
-
-/*
- * transformExtendStmt -
- * transform the qualifications of the Extend Index Statement
- *
- */
-static Query *
-transformExtendStmt(ParseState *pstate, ExtendStmt *stmt)
-{
- Query *qry;
+ 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);
- qry = makeNode(Query);
- qry->commandType = CMD_UTILITY;
+ /* no to join list, yes to namespace */
+ addRTEtoQuery(pstate, rte, false, true);
- /* take care of the where clause */
- stmt->whereClause = transformWhereClause(pstate, stmt->whereClause);
+ stmt->whereClause = transformWhereClause(pstate, stmt->whereClause);
+ }
qry->hasSubLinks = pstate->p_hasSubLinks;
-
stmt->rangetable = pstate->p_rtable;
qry->utilityStmt = (Node *) stmt;
+
return qry;
}
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index b83ca3783fd..99312049a83 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -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;
}
;
@@ -2474,22 +2473,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:
* execute recipe <recipeName>
*
*****************************************************************************/
@@ -5775,7 +5758,6 @@ ColLabel: ColId { $$ = $1; }
| EXCEPT { $$ = "except"; }
| EXISTS { $$ = "exists"; }
| EXPLAIN { $$ = "explain"; }
- | EXTEND { $$ = "extend"; }
| EXTRACT { $$ = "extract"; }
| FALSE_P { $$ = "false"; }
| FLOAT { $$ = "float"; }
diff --git a/src/backend/parser/keywords.c b/src/backend/parser/keywords.c
index ccdfb88a2e2..014b1198503 100644
--- a/src/backend/parser/keywords.c
+++ b/src/backend/parser/keywords.c
@@ -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},