* 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
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
_outNode(str, node->args);
appendStringInfo(str, " :class ");
_outToken(str, node->class);
- appendStringInfo(str, " :typename ");
- _outNode(str, node->typename);
}
static void
* 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 $
*
*-------------------------------------------------------------------------
*/
iparam->name = pstrdup(column->colname);
iparam->args = NIL;
iparam->class = NULL;
- iparam->typename = NULL;
index->indexParams = lappend(index->indexParams, iparam);
if (index->idxname == NULL)
*
*
* 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
%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
}
| FCONST { $$ = $1; }
| Sconst { $$ = $1; }
- | IDENT { $$ = $1; }
+ | ColId { $$ = $1; }
;
OptConstrFromTable: /* Empty */
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;
| 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,
;
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
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
Iconst: ICONST { $$ = $1; };
Sconst: SCONST { $$ = $1; };
-UserId: IDENT { $$ = $1; };
+UserId: ColId { $$ = $1; };
/* Column identifier
* Include date/time keywords as SQL92 extension.
* 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 $
*
*-------------------------------------------------------------------------
*/
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;
/*
* 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;
/*