diff options
Diffstat (limited to 'src/backend/parser/gram.y')
-rw-r--r-- | src/backend/parser/gram.y | 68 |
1 files changed, 30 insertions, 38 deletions
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y index 53759b80296..5c77aebfe62 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.355 2002/08/04 19:48:09 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.356 2002/08/05 02:30:50 tgl Exp $ * * HISTORY * AUTHOR DATE MAJOR EVENT @@ -203,7 +203,7 @@ static void doNegateFloat(Value *v); %type <chr> TriggerOneEvent %type <list> stmtblock, stmtmulti, - OptTableElementList, OptInherit, definition, + OptTableElementList, TableElementList, OptInherit, definition, opt_distinct, opt_definition, func_args, func_args_list, func_as, createfunc_opt_list oper_argtypes, RuleActionList, RuleActionMulti, @@ -216,7 +216,7 @@ static void doNegateFloat(Value *v); insert_target_list, def_list, opt_indirection, group_clause, TriggerFuncArgs, select_limit, opt_select_limit, opclass_item_list, trans_options, - tableFuncElementList + TableFuncElementList, OptTableFuncElementList %type <range> into_clause, OptTempTableName @@ -257,8 +257,8 @@ static void doNegateFloat(Value *v); %type <vsetstmt> set_rest -%type <node> OptTableElement, ConstraintElem, tableFuncElement -%type <node> columnDef, tableFuncColumnDef +%type <node> TableElement, ConstraintElem, TableFuncElement +%type <node> columnDef %type <defelt> def_elem %type <node> def_arg, columnElem, where_clause, insert_column_item, a_expr, b_expr, c_expr, r_expr, AexprConst, @@ -1428,24 +1428,22 @@ OptTemp: TEMPORARY { $$ = TRUE; } ; OptTableElementList: - OptTableElementList ',' OptTableElement + TableElementList { $$ = $1; } + | /*EMPTY*/ { $$ = NIL; } + ; + +TableElementList: + TableElementList ',' TableElement { - if ($3 != NULL) - $$ = lappend($1, $3); - else - $$ = $1; + $$ = lappend($1, $3); } - | OptTableElement + | TableElement { - if ($1 != NULL) - $$ = makeList1($1); - else - $$ = NIL; + $$ = makeList1($1); } - | /*EMPTY*/ { $$ = NIL; } ; -OptTableElement: +TableElement: columnDef { $$ = $1; } | TableLikeClause { $$ = $1; } | TableConstraint { $$ = $1; } @@ -1877,7 +1875,7 @@ CreateSeqStmt: ; OptSeqList: OptSeqList OptSeqElem { $$ = lappend($1, $2); } - | { $$ = NIL; } + | /*EMPTY*/ { $$ = NIL; } ; OptSeqElem: CACHE NumericOnly @@ -4452,14 +4450,14 @@ table_ref: relation_expr n->coldeflist = NIL; $$ = (Node *) n; } - | func_table AS '(' tableFuncElementList ')' + | func_table AS '(' OptTableFuncElementList ')' { RangeFunction *n = makeNode(RangeFunction); n->funccallnode = $1; n->coldeflist = $4; $$ = (Node *) n; } - | func_table AS ColId '(' tableFuncElementList ')' + | func_table AS ColId '(' OptTableFuncElementList ')' { RangeFunction *n = makeNode(RangeFunction); Alias *a = makeNode(Alias); @@ -4469,7 +4467,7 @@ table_ref: relation_expr n->coldeflist = $5; $$ = (Node *) n; } - | func_table ColId '(' tableFuncElementList ')' + | func_table ColId '(' OptTableFuncElementList ')' { RangeFunction *n = makeNode(RangeFunction); Alias *a = makeNode(Alias); @@ -4733,29 +4731,23 @@ where_clause: ; -tableFuncElementList: - tableFuncElementList ',' tableFuncElement +OptTableFuncElementList: + TableFuncElementList { $$ = $1; } + | /*EMPTY*/ { $$ = NIL; } + ; + +TableFuncElementList: + TableFuncElementList ',' TableFuncElement { - if ($3 != NULL) - $$ = lappend($1, $3); - else - $$ = $1; + $$ = lappend($1, $3); } - | tableFuncElement + | TableFuncElement { - if ($1 != NULL) - $$ = makeList1($1); - else - $$ = NIL; + $$ = makeList1($1); } - | /*EMPTY*/ { $$ = NIL; } - ; - -tableFuncElement: - tableFuncColumnDef { $$ = $1; } ; -tableFuncColumnDef: ColId Typename +TableFuncElement: ColId Typename { ColumnDef *n = makeNode(ColumnDef); n->colname = $1; |