]> granicus.if.org Git - postgresql/commitdiff
Remove useless and dangerous 'opt_type' option from CREATE INDEX.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 15 Jul 2000 00:01:41 +0000 (00:01 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 15 Jul 2000 00:01:41 +0000 (00:01 +0000)
src/backend/nodes/outfuncs.c
src/backend/parser/analyze.c
src/backend/parser/gram.y
src/include/nodes/parsenodes.h

index 2999c4263b15bb1826e59cab1c10a93a97b5007c..f6fed845069c68ac23de4ef2cc23c63ed3c1e2a2 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- *     $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.121 2000/07/12 02:37:06 tgl Exp $
+ *     $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.122 2000/07/15 00:01:37 tgl Exp $
  *
  * NOTES
  *       Every (plan) node in POSTGRES has an associated "out" routine which
@@ -139,9 +139,9 @@ _outIndexStmt(StringInfo str, IndexStmt *node)
        appendStringInfo(str, " :rangetable ");
        _outNode(str, node->rangetable);
 
-       appendStringInfo(str, " :lossy %s :unique %s ",
-                                        node->lossy ? "true" : "false",
-                                        node->unique ? "true" : "false");
+       appendStringInfo(str, " :unique %s :primary %s ",
+                                        node->unique ? "true" : "false",
+                                        node->primary ? "true" : "false");
 }
 
 static void
@@ -210,8 +210,6 @@ _outIndexElem(StringInfo str, IndexElem *node)
        _outNode(str, node->args);
        appendStringInfo(str, " :class ");
        _outToken(str, node->class);
-       appendStringInfo(str, " :typename ");
-       _outNode(str, node->typename);
 }
 
 static void
index 1d1cf7acf4869421b1b97d46fc42521d51ba0d9d..b5305edb54b5252febe46d488736cd8ff47a6413 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- *     $Id: analyze.c,v 1.150 2000/07/14 15:43:32 thomas Exp $
+ *     $Id: analyze.c,v 1.151 2000/07/15 00:01:41 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -947,7 +947,6 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt)
                        iparam->name = pstrdup(column->colname);
                        iparam->args = NIL;
                        iparam->class = NULL;
-                       iparam->typename = NULL;
                        index->indexParams = lappend(index->indexParams, iparam);
 
                        if (index->idxname == NULL)
index cf1f15ba4e5d95ef5644ebd5a4fd8ecf37a403ef..16bac38748a632a47ad58fedfb51e5f5145266c2 100644 (file)
@@ -11,7 +11,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.178 2000/07/14 15:43:32 thomas Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.179 2000/07/15 00:01:41 tgl Exp $
  *
  * HISTORY
  *       AUTHOR                        DATE                    MAJOR EVENT
@@ -250,7 +250,7 @@ static void doNegateFloat(Value *v);
 %type <target> target_el, update_target_el
 %type <paramno> ParamNo
 
-%type <typnam> Typename, opt_type, SimpleTypename, ConstTypename
+%type <typnam> Typename, SimpleTypename, ConstTypename
                                Generic, Numeric, Character, ConstDatetime, ConstInterval, Bit
 %type <str>            typename, generic, numeric, character, datetime, bit
 %type <str>            extract_arg
@@ -1778,7 +1778,7 @@ TriggerFuncArg:  ICONST
                                }
                        | FCONST                                                {  $$ = $1; }
                        | Sconst                                                {  $$ = $1; }
-                       | IDENT                                                 {  $$ = $1; }
+                       | ColId                                                 {  $$ = $1; }
                ;
 
 OptConstrFromTable:                    /* Empty */
@@ -2315,8 +2315,6 @@ RevokeStmt:  REVOKE privileges ON relation_name_list FROM grantee
 IndexStmt:     CREATE index_opt_unique INDEX index_name ON relation_name
                        access_method_clause '(' index_params ')' opt_with
                                {
-                                       /* should check that access_method is valid,
-                                          etc ... but doesn't */
                                        IndexStmt *n = makeNode(IndexStmt);
                                        n->unique = $2;
                                        n->idxname = $4;
@@ -2345,37 +2343,24 @@ index_list:  index_list ',' index_elem                  { $$ = lappend($1, $3); }
                | index_elem                                                    { $$ = lcons($1, NIL); }
                ;
 
-func_index:  func_name '(' name_list ')' opt_type opt_class
+func_index:  func_name '(' name_list ')' opt_class
                                {
                                        $$ = makeNode(IndexElem);
                                        $$->name = $1;
                                        $$->args = $3;
-                                       $$->class = $6;
-                                       $$->typename = $5;
+                                       $$->class = $5;
                                }
                  ;
 
-index_elem:  attr_name opt_type opt_class
+index_elem:  attr_name opt_class
                                {
                                        $$ = makeNode(IndexElem);
                                        $$->name = $1;
                                        $$->args = NIL;
-                                       $$->class = $3;
-                                       $$->typename = $2;
+                                       $$->class = $2;
                                }
                ;
 
-opt_type:  ':' Typename                                                        { $$ = $2; }
-               | FOR Typename                                                  { $$ = $2; }
-               | /*EMPTY*/                                                             { $$ = NULL; }
-               ;
-
-/* opt_class "WITH class" conflicts with preceeding opt_type
- *  for Typename of "TIMESTAMP WITH TIME ZONE"
- * So, remove "WITH class" from the syntax. OK??
- * - thomas 1997-10-12
- *             | WITH class                                                    { $$ = $2; }
- */
 opt_class:  class                                                              {
        /*
         * Release 7.0 removed network_ops, timespan_ops, and datetime_ops, 
@@ -5352,9 +5337,9 @@ relation_name:    SpecialRuleRelation
                ;
 
 database_name:                 ColId                   { $$ = $1; };
-access_method:                 IDENT                   { $$ = $1; };
+access_method:                 ColId                   { $$ = $1; };
 attr_name:                             ColId                   { $$ = $1; };
-class:                                 IDENT                   { $$ = $1; };
+class:                                 ColId                   { $$ = $1; };
 index_name:                            ColId                   { $$ = $1; };
 
 /* Functions
@@ -5365,7 +5350,6 @@ name:                                     ColId                   { $$ = $1; };
 func_name:                             ColId                   { $$ = xlateSqlFunc($1); };
 
 file_name:                             Sconst                  { $$ = $1; };
-/* NOT USED recipe_name:                       IDENT                   { $$ = $1; };*/
 
 /* Constants
  * Include TRUE/FALSE for SQL3 support. - thomas 1997-10-24
@@ -5453,7 +5437,7 @@ ParamNo:  PARAM opt_indirection
 
 Iconst:  ICONST                                                        { $$ = $1; };
 Sconst:  SCONST                                                        { $$ = $1; };
-UserId:  IDENT                                                 { $$ = $1; };
+UserId:  ColId                                                 { $$ = $1; };
 
 /* Column identifier
  * Include date/time keywords as SQL92 extension.
index 388efc2ebdc3bd301c76068cdd455a4af2a4656f..8516da8800eb378a0bce6fcb15aca39045e2e144 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: parsenodes.h,v 1.109 2000/07/14 15:43:51 thomas Exp $
+ * $Id: parsenodes.h,v 1.110 2000/07/15 00:01:38 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -467,13 +467,12 @@ typedef struct IndexStmt
        NodeTag         type;
        char       *idxname;            /* name of the index */
        char       *relname;            /* name of relation to index on */
-       char       *accessMethod;       /* name of acess methood (eg. btree) */
+       char       *accessMethod;       /* name of access method (eg. btree) */
        List       *indexParams;        /* a list of IndexElem */
        List       *withClause;         /* a list of DefElem */
-       Node       *whereClause;        /* qualifications */
-       List       *rangetable;         /* range table, filled in by
+       Node       *whereClause;        /* qualification (partial-index predicate) */
+       List       *rangetable;         /* range table for qual, filled in by
                                                                 * transformStmt() */
-       bool       *lossy;                      /* is index lossy? */
        bool            unique;                 /* is index unique? */
        bool            primary;                /* is index on primary key? */
 } IndexStmt;
@@ -1088,14 +1087,18 @@ typedef struct RangeVar
 
 /*
  * IndexElem - index parameters (used in CREATE INDEX)
+ *
+ * For a plain index, each 'name' is an attribute name in the heap relation,
+ * and 'args' is NIL.  For a functional index, only one IndexElem is allowed.
+ * It has name = name of function and args = list of attribute names that
+ * are the function's arguments.
  */
 typedef struct IndexElem
 {
        NodeTag         type;
-       char       *name;                       /* name of index */
-       List       *args;                       /* if not NULL, function index */
-       char       *class;
-       TypeName   *typename;           /* type of index's keys (optional) */
+       char       *name;                       /* name of attribute to index, or function */
+       List       *args;                       /* list of names of function arguments */
+       char       *class;                      /* name of desired opclass; NULL = default */
 } IndexElem;
 
 /*