276a277,285 > > /* WITH CLAUSE */ > > %type opt_recursive > %type with_list_element > %type with_list > > /* /WITH CLAUSE */ > 374c383,387 < READ, REAL, REFERENCES, REINDEX, RELATIVE, RENAME, REPLACE, --- > READ, REAL, > > RECURSIVE, > > REFERENCES, REINDEX, RELATIVE, RENAME, REPLACE, 4023,4024c4036,4037 < SelectStmt: select_no_parens %prec UMINUS < | select_with_parens %prec UMINUS --- > SelectStmt: select_no_parens %prec UMINUS > | select_with_parens %prec UMINUS 4028,4029c4041,4042 < '(' select_no_parens ')' { $$ = $2; } < | '(' select_with_parens ')' { $$ = $2; } --- > '(' select_no_parens ')' { $$ = $2; } > | '(' select_with_parens ')' { $$ = $2; } 4031a4045 > 4033c4047,4058 < simple_select { $$ = $1; } --- > simple_select { $$ = $1; } > | WITH opt_recursive with_list simple_select > { > /* this should actually blend in subselects from WITH > * just replacing will do the WRONG THING > */ > ((SelectStmt *) $4 )->with_recursive = $2; > ((SelectStmt *) $4 )->withClause = $3; > > $$ = $4; > } > 4039a4065,4072 > /* > | WITH RECURSIVE with_list select_clause sort_clause opt_for_update_clause opt_select_limit > { > insertSelectOptions((SelectStmt *) $2, $3, $4, > nth(0, $5), nth(1, $5)); > $$ = $1; > } > */ 4045a4079,4087 > /* > | WITH RECURSIVE with_list select_clause for_update_clause opt_select_limit > { > insertSelectOptions((SelectStmt *) $2, NIL, $3, > nth(0, $4), nth(1, $4)); > $$ = $1; > } > */ > 4051a4094,4100 > | WITH opt_recursive with_list select_clause select_limit > { > insertSelectOptions((SelectStmt *) $4, NIL, NIL, > nth(0, $5), nth(1, $5)); > $$ = $4; > } > 4053a4103,4141 > /* WITH CLAUSE > * > * ANSI/ISO SQL99 p 7.13-7.14 > * > */ > > opt_recursive: > RECURSIVE { $$ = TRUE; } > | /*EMPTY */ { $$ = FALSE; } > ; > > with_list: > with_list_element { $$ = makeList1($1); } > | with_list ',' with_list_element { $$ = lappend($1, $3); } > ; > > with_list_element: > ColId '(' name_list ')' AS select_with_parens > { > RangeSubselect *n = makeNode(RangeSubselect); > n->subquery = $6; > n->alias = makeNode(Alias); > n->alias->aliasname = $1; > n->alias->colnames = $3; > $$ = (Node *) n; > } > | ColId AS select_with_parens > { > RangeSubselect *n = makeNode(RangeSubselect); > n->subquery = $3; > n->alias = makeNode(Alias); > n->alias->aliasname = $1; > $$ = (Node *) n; > } > ; > > /* /WITH CLAUSE */ > > 6772d6859 < | WITH 6916a7004 > | RECURSIVE 6931a7020 > | WITH