提交 582e22a8 编写于 作者: M Michael Meskes

Simplified sortby rule

上级 d3e131e0
......@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.581 2007/03/13 00:33:41 tgl Exp $
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.582 2007/03/17 19:27:12 meskes Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
......@@ -3869,8 +3869,8 @@ opt_class: any_name { $$ = $1; }
;
opt_asc_desc: ASC { $$ = SORTBY_ASC; }
| DESC { $$ = SORTBY_DESC; }
| /*EMPTY*/ { $$ = SORTBY_DEFAULT; }
| DESC { $$ = SORTBY_DESC; }
| /*EMPTY*/ { $$ = SORTBY_DEFAULT; }
;
opt_nulls_order: NULLS_FIRST { $$ = SORTBY_NULLS_FIRST; }
......@@ -5982,30 +5982,14 @@ sortby: a_expr USING qual_all_Op opt_nulls_order
$$->sortby_nulls = $4;
$$->useOp = $3;
}
| a_expr ASC opt_nulls_order
| a_expr opt_asc_desc opt_nulls_order
{
$$ = makeNode(SortBy);
$$->node = $1;
$$->sortby_dir = SORTBY_ASC;
$$->sortby_dir = $2;
$$->sortby_nulls = $3;
$$->useOp = NIL;
}
| a_expr DESC opt_nulls_order
{
$$ = makeNode(SortBy);
$$->node = $1;
$$->sortby_dir = SORTBY_DESC;
$$->sortby_nulls = $3;
$$->useOp = NIL;
}
| a_expr opt_nulls_order
{
$$ = makeNode(SortBy);
$$->node = $1;
$$->sortby_dir = SORTBY_DEFAULT;
$$->sortby_nulls = $2;
$$->useOp = NIL;
}
;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册