Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
1df43911
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1df43911
编写于
8月 19, 2017
作者:
H
Heikki Linnakangas
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move WINDOW clause stuff in grammar to where it is in PostgreSQL 8.4.
Hopefully reduce merge conflicts in the future.
上级
d14de97c
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
177 addition
and
173 deletion
+177
-173
src/backend/parser/gram.y
src/backend/parser/gram.y
+177
-173
未找到文件。
src/backend/parser/gram.y
浏览文件 @
1df43911
...
...
@@ -364,18 +364,6 @@ static Node *makeIsNotDistinctFromNode(Node *expr, int position);
%type <node> def_arg columnElem where_clause where_or_current_clause
a_expr b_expr c_expr simple_func func_expr AexprConst indirection_el
columnref in_expr having_clause func_table array_expr
%type <list> window_definition_list window_clause
%type <boolean> window_frame_units
%type <ival> window_frame_exclusion
%type <node> window_spec
%type <node> window_frame_extent
window_frame_start window_frame_preceding window_frame_between
window_frame_bound window_frame_following
window_frame_clause opt_window_frame_clause
%type <list> window_partition_clause opt_window_partition_clause
opt_window_order_clause
%type <str> opt_window_name window_name
%type <list> row type_list array_expr_list
%type <node> case_expr case_arg when_clause when_operand case_default
%type <list> when_clause_list
...
...
@@ -476,6 +464,18 @@ static Node *makeIsNotDistinctFromNode(Node *expr, int position);
%type <with> with_clause
%type <list> cte_list
%type <list> window_definition_list window_clause
%type <boolean> window_frame_units
%type <ival> window_frame_exclusion
%type <node> window_spec
%type <node> window_frame_extent
window_frame_start window_frame_preceding window_frame_between
window_frame_bound window_frame_following
window_frame_clause opt_window_frame_clause
%type <list> window_partition_clause opt_window_partition_clause
opt_window_order_clause
%type <str> opt_window_name window_name
/*
* If you make any token changes, update the keyword table in
...
...
@@ -9750,167 +9750,6 @@ having_clause:
| /*EMPTY*/ { $$ = NULL; }
;
window_clause:
WINDOW window_definition_list { $$ = $2; }
| /*EMPTY*/ { $$ = NIL; }
;
window_definition_list:
window_name AS '(' window_spec ')'
{
((WindowSpec *)$4)->name = $1;
((WindowSpec *)$4)->location = @3;
$$ = list_make1($4);
}
| window_definition_list ',' window_name AS '(' window_spec ')'
{
((WindowSpec *)$6)->name = $3;
((WindowSpec *)$6)->location = @5;
$$ = lappend($1, $6);
}
;
window_spec: opt_window_name opt_window_partition_clause
opt_window_order_clause opt_window_frame_clause
{
WindowSpec *n = makeNode(WindowSpec);
n->parent = $1;
n->partition = $2;
n->order = $3;
n->frame = (WindowFrame *)$4;
n->location = -1;
$$ = (Node *)n;
}
;
opt_window_name: window_name { $$ = $1; }
| /*EMPTY*/ { $$ = NULL; }
;
opt_window_partition_clause: window_partition_clause { $$ = $1; }
| /*EMPTY*/ { $$ = NIL; }
;
window_partition_clause: PARTITION BY sortby_list { $$ = (List *)$3; }
;
opt_window_order_clause: sort_clause { $$ = $1; }
| /*EMPTY*/ { $$ = NIL; }
;
opt_window_frame_clause: window_frame_clause { $$ = $1; }
| /*EMPTY*/ { $$ = NULL; }
;
window_frame_clause: window_frame_units window_frame_extent
window_frame_exclusion
{
WindowFrame *n = makeNode(WindowFrame);
n->is_rows = $1;
setWindowExclude(n, $3);
if (IsA($2, List))
{
List *ex = (List *)$2;
n->trail = (WindowFrameEdge *)linitial(ex);
n->lead = (WindowFrameEdge *)lsecond(ex);
n->is_between = true;
}
else
{
Assert(IsA($2, WindowFrameEdge));
n->trail = (WindowFrameEdge *)$2;
n->lead = NULL;
n->is_between = false;
}
$$ = (Node *)n;
}
;
/* units are either rows (true) otherwise false */
window_frame_units: ROWS { $$ = true; }
| RANGE { $$ = false; }
;
window_frame_extent:
window_frame_start { $$ = $1; }
| window_frame_between { $$ = $1; }
;
window_frame_start:
UNBOUNDED PRECEDING
{
WindowFrameEdge *n = makeNode(WindowFrameEdge);
n->kind = WINDOW_UNBOUND_PRECEDING;
n->val = NULL;
$$ = (Node *)n;
}
| window_frame_preceding
{
WindowFrameEdge *n = makeNode(WindowFrameEdge);
n->kind = WINDOW_BOUND_PRECEDING;
n->val = $1;
$$ = (Node *)n;
}
| CURRENT_P ROW
{
WindowFrameEdge *n = makeNode(WindowFrameEdge);
n->kind = WINDOW_CURRENT_ROW;
$$ = (Node *)n;
}
;
window_frame_preceding: a_expr PRECEDING
{
$$ = (Node *)$1;
}
;
window_frame_between:
BETWEEN window_frame_bound AND window_frame_bound
{
/* slightly dodgy hack */
$$ = (Node *)list_make2($2, $4);
}
;
/*
* Be careful that we don't allow BETWEEN UNBOUND PRECEDING AND
* UNBOUND PRECEDING
*/
window_frame_bound:
window_frame_start { $$ = $1; }
| UNBOUNDED FOLLOWING
{
WindowFrameEdge *n = makeNode(WindowFrameEdge);
n->kind = WINDOW_UNBOUND_FOLLOWING;
n->val = NULL;
$$ = (Node *)n;
}
| window_frame_following
{
WindowFrameEdge *n = makeNode(WindowFrameEdge);
n->kind = WINDOW_BOUND_FOLLOWING;
n->val = $1;
$$ = (Node *)n;
}
;
window_frame_following: a_expr FOLLOWING
{
$$ = (Node *)$1;
}
;
window_frame_exclusion: EXCLUDE CURRENT_P ROW { $$ = WINDOW_EXCLUSION_CUR_ROW; }
| EXCLUDE GROUP_P { $$ = WINDOW_EXCLUSION_GROUP; }
| EXCLUDE TIES { $$ = WINDOW_EXCLUSION_TIES; }
| EXCLUDE NO OTHERS { $$ = WINDOW_EXCLUSION_NO_OTHERS; }
| /*EMPTY*/ { $$ = WINDOW_EXCLUSION_NULL; }
;
for_locking_clause:
for_locking_items { $$ = $1; }
| FOR READ ONLY { $$ = NIL; }
...
...
@@ -12238,6 +12077,171 @@ xmlexists_argument:
;
/*
* Window Definitions
*/
window_clause:
WINDOW window_definition_list { $$ = $2; }
| /*EMPTY*/ { $$ = NIL; }
;
window_definition_list:
window_name AS '(' window_spec ')'
{
((WindowSpec *)$4)->name = $1;
((WindowSpec *)$4)->location = @3;
$$ = list_make1($4);
}
| window_definition_list ',' window_name AS '(' window_spec ')'
{
((WindowSpec *)$6)->name = $3;
((WindowSpec *)$6)->location = @5;
$$ = lappend($1, $6);
}
;
window_spec: opt_window_name opt_window_partition_clause
opt_window_order_clause opt_window_frame_clause
{
WindowSpec *n = makeNode(WindowSpec);
n->parent = $1;
n->partition = $2;
n->order = $3;
n->frame = (WindowFrame *)$4;
n->location = -1;
$$ = (Node *)n;
}
;
opt_window_name: window_name { $$ = $1; }
| /*EMPTY*/ { $$ = NULL; }
;
opt_window_partition_clause: window_partition_clause { $$ = $1; }
| /*EMPTY*/ { $$ = NIL; }
;
window_partition_clause: PARTITION BY sortby_list { $$ = (List *)$3; }
;
opt_window_order_clause: sort_clause { $$ = $1; }
| /*EMPTY*/ { $$ = NIL; }
;
opt_window_frame_clause: window_frame_clause { $$ = $1; }
| /*EMPTY*/ { $$ = NULL; }
;
window_frame_clause: window_frame_units window_frame_extent
window_frame_exclusion
{
WindowFrame *n = makeNode(WindowFrame);
n->is_rows = $1;
setWindowExclude(n, $3);
if (IsA($2, List))
{
List *ex = (List *)$2;
n->trail = (WindowFrameEdge *)linitial(ex);
n->lead = (WindowFrameEdge *)lsecond(ex);
n->is_between = true;
}
else
{
Assert(IsA($2, WindowFrameEdge));
n->trail = (WindowFrameEdge *)$2;
n->lead = NULL;
n->is_between = false;
}
$$ = (Node *)n;
}
;
/* units are either rows (true) otherwise false */
window_frame_units: ROWS { $$ = true; }
| RANGE { $$ = false; }
;
window_frame_extent:
window_frame_start { $$ = $1; }
| window_frame_between { $$ = $1; }
;
window_frame_start:
UNBOUNDED PRECEDING
{
WindowFrameEdge *n = makeNode(WindowFrameEdge);
n->kind = WINDOW_UNBOUND_PRECEDING;
n->val = NULL;
$$ = (Node *)n;
}
| window_frame_preceding
{
WindowFrameEdge *n = makeNode(WindowFrameEdge);
n->kind = WINDOW_BOUND_PRECEDING;
n->val = $1;
$$ = (Node *)n;
}
| CURRENT_P ROW
{
WindowFrameEdge *n = makeNode(WindowFrameEdge);
n->kind = WINDOW_CURRENT_ROW;
$$ = (Node *)n;
}
;
window_frame_preceding: a_expr PRECEDING
{
$$ = (Node *)$1;
}
;
window_frame_between:
BETWEEN window_frame_bound AND window_frame_bound
{
/* slightly dodgy hack */
$$ = (Node *)list_make2($2, $4);
}
;
/*
* Be careful that we don't allow BETWEEN UNBOUND PRECEDING AND
* UNBOUND PRECEDING
*/
window_frame_bound:
window_frame_start { $$ = $1; }
| UNBOUNDED FOLLOWING
{
WindowFrameEdge *n = makeNode(WindowFrameEdge);
n->kind = WINDOW_UNBOUND_FOLLOWING;
n->val = NULL;
$$ = (Node *)n;
}
| window_frame_following
{
WindowFrameEdge *n = makeNode(WindowFrameEdge);
n->kind = WINDOW_BOUND_FOLLOWING;
n->val = $1;
$$ = (Node *)n;
}
;
window_frame_following: a_expr FOLLOWING
{
$$ = (Node *)$1;
}
;
window_frame_exclusion: EXCLUDE CURRENT_P ROW { $$ = WINDOW_EXCLUSION_CUR_ROW; }
| EXCLUDE GROUP_P { $$ = WINDOW_EXCLUSION_GROUP; }
| EXCLUDE TIES { $$ = WINDOW_EXCLUSION_TIES; }
| EXCLUDE NO OTHERS { $$ = WINDOW_EXCLUSION_NO_OTHERS; }
| /*EMPTY*/ { $$ = WINDOW_EXCLUSION_NULL; }
;
/*
* Supporting nonterminals for expressions.
*/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录