Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
e6c714bf
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,发现更多精彩内容 >>
提交
e6c714bf
编写于
1月 10, 1998
作者:
B
Bruce Momjian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Bye CursorStmt, now use SelectStmt.
上级
e7b205b4
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
26 addition
and
69 deletion
+26
-69
src/backend/parser/analyze.c
src/backend/parser/analyze.c
+13
-43
src/backend/parser/gram.y
src/backend/parser/gram.y
+9
-6
src/include/nodes/nodes.h
src/include/nodes/nodes.h
+1
-2
src/include/nodes/parsenodes.h
src/include/nodes/parsenodes.h
+3
-18
未找到文件。
src/backend/parser/analyze.c
浏览文件 @
e6c714bf
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.6
2 1998/01/09 20:05:49
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.6
3 1998/01/10 04:29:47
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -39,7 +39,7 @@ static Query *transformExtendStmt(ParseState *pstate, ExtendStmt *stmt);
static
Query
*
transformRuleStmt
(
ParseState
*
query
,
RuleStmt
*
stmt
);
static
Query
*
transformSelectStmt
(
ParseState
*
pstate
,
SelectStmt
*
stmt
);
static
Query
*
transformUpdateStmt
(
ParseState
*
pstate
,
UpdateStmt
*
stmt
);
static
Query
*
transformCursorStmt
(
ParseState
*
pstate
,
Cursor
Stmt
*
stmt
);
static
Query
*
transformCursorStmt
(
ParseState
*
pstate
,
Select
Stmt
*
stmt
);
static
Query
*
transformCreateStmt
(
ParseState
*
pstate
,
CreateStmt
*
stmt
);
List
*
extras
=
NIL
;
...
...
@@ -175,12 +175,11 @@ transformStmt(ParseState *pstate, Node *parseTree)
result
=
transformUpdateStmt
(
pstate
,
(
UpdateStmt
*
)
parseTree
);
break
;
case
T_CursorStmt
:
result
=
transformCursorStmt
(
pstate
,
(
CursorStmt
*
)
parseTree
);
break
;
case
T_SelectStmt
:
result
=
transformSelectStmt
(
pstate
,
(
SelectStmt
*
)
parseTree
);
if
(
!
((
SelectStmt
*
)
parseTree
)
->
portalname
)
result
=
transformSelectStmt
(
pstate
,
(
SelectStmt
*
)
parseTree
);
else
result
=
transformCursorStmt
(
pstate
,
(
SelectStmt
*
)
parseTree
);
break
;
default:
...
...
@@ -873,6 +872,9 @@ transformUpdateStmt(ParseState *pstate, UpdateStmt *stmt)
qry
->
rtable
=
pstate
->
p_rtable
;
qry
->
resultRelation
=
refnameRangeTablePosn
(
pstate
->
p_rtable
,
stmt
->
relname
);
if
(
pstate
->
p_numAgg
>
0
)
finalizeAggregates
(
pstate
,
qry
);
/* make sure we don't have aggregates in the where clause */
if
(
pstate
->
p_numAgg
>
0
)
parseCheckAggregates
(
pstate
,
qry
);
...
...
@@ -886,47 +888,15 @@ transformUpdateStmt(ParseState *pstate, UpdateStmt *stmt)
*
*/
static
Query
*
transformCursorStmt
(
ParseState
*
pstate
,
Cursor
Stmt
*
stmt
)
transformCursorStmt
(
ParseState
*
pstate
,
Select
Stmt
*
stmt
)
{
Query
*
qry
=
makeNode
(
Query
);
/*
* in the old days, a cursor statement is a 'retrieve into portal'; If
* you change the following, make sure you also go through the code in
* various places that tests the kind of operation.
*/
qry
->
commandType
=
CMD_SELECT
;
Query
*
qry
;
/* set up a range table */
makeRangeTable
(
pstate
,
NULL
,
stmt
->
fromClause
);
qry
->
uniqueFlag
=
stmt
->
unique
;
qry
=
transformSelectStmt
(
pstate
,
stmt
);
qry
->
into
=
stmt
->
portalname
;
qry
->
isPortal
=
TRUE
;
qry
->
isBinary
=
stmt
->
binary
;
/* internal portal */
/* fix the target list */
qry
->
targetList
=
transformTargetList
(
pstate
,
stmt
->
targetList
);
/* fix where clause */
qry
->
qual
=
transformWhereClause
(
pstate
,
stmt
->
whereClause
);
/* fix order clause */
qry
->
sortClause
=
transformSortClause
(
pstate
,
stmt
->
sortClause
,
NIL
,
qry
->
targetList
,
qry
->
uniqueFlag
);
/* fix group by clause */
qry
->
groupClause
=
transformGroupClause
(
pstate
,
stmt
->
groupClause
,
qry
->
targetList
);
qry
->
rtable
=
pstate
->
p_rtable
;
if
(
pstate
->
p_numAgg
>
0
)
finalizeAggregates
(
pstate
,
qry
);
return
(
Query
*
)
qry
;
return
qry
;
}
src/backend/parser/gram.y
浏览文件 @
e6c714bf
...
...
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.8
7 1998/01/09 21:26:12
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.8
8 1998/01/10 04:29:50
momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
...
...
@@ -2226,12 +2226,13 @@ UpdateStmt: UPDATE relation_name
* CURSOR STATEMENTS
*
*****************************************************************************/
CursorStmt: DECLARE name opt_binary CURSOR FOR
SELECT opt_unique res_target_list2
from_clause where_clause group_clause sort_clause
SELECT opt_unique res_target_list2
from_clause where_clause
group_clause having_clause
union_clause sort_clause
{
CursorStmt *n = makeNode(Cursor
Stmt);
SelectStmt *n = makeNode(Select
Stmt);
/* from PORTAL name */
/*
...
...
@@ -2251,7 +2252,9 @@ CursorStmt: DECLARE name opt_binary CURSOR FOR
n->fromClause = $9;
n->whereClause = $10;
n->groupClause = $11;
n->sortClause = $12;
n->havingClause = $12;
n->unionClause = $13;
n->sortClause = $14;
$$ = (Node *)n;
}
;
...
...
src/include/nodes/nodes.h
浏览文件 @
e6c714bf
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: nodes.h,v 1.2
1 1998/01/09 21:13:43
momjian Exp $
* $Id: nodes.h,v 1.2
2 1998/01/10 04:30:08
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -145,7 +145,6 @@ typedef enum NodeTag
T_InsertStmt
,
T_DeleteStmt
,
T_UpdateStmt
,
T_CursorStmt
,
T_SelectStmt
,
T_AddAttrStmt
,
T_AggregateStmt
,
...
...
src/include/nodes/parsenodes.h
浏览文件 @
e6c714bf
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: parsenodes.h,v 1.4
1 1998/01/09 20:06:08
momjian Exp $
* $Id: parsenodes.h,v 1.4
2 1998/01/10 04:30:11
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -604,23 +604,6 @@ typedef struct UpdateStmt
List
*
fromClause
;
/* the from clause */
}
UpdateStmt
;
/* ----------------------
* Create Cursor Statement
* ----------------------
*/
typedef
struct
CursorStmt
{
NodeTag
type
;
char
*
portalname
;
/* the portal (cursor) to create */
bool
binary
;
/* a binary (internal) portal? */
char
*
unique
;
/* NULL, "*", or unique attribute name */
List
*
targetList
;
/* the target list (of ResTarget) */
List
*
fromClause
;
/* the from clause */
Node
*
whereClause
;
/* qualifications */
List
*
groupClause
;
/* group by clause */
List
*
sortClause
;
/* sort clause (a list of SortGroupBy's) */
}
CursorStmt
;
/* ----------------------
* Select Statement
* ----------------------
...
...
@@ -637,6 +620,8 @@ typedef struct SelectStmt
Node
*
havingClause
;
/* having conditional-expression */
List
*
unionClause
;
/* union subselect parameters */
List
*
sortClause
;
/* sort clause (a list of SortGroupBy's) */
char
*
portalname
;
/* the portal (cursor) to create */
bool
binary
;
/* a binary (internal) portal? */
bool
unionall
;
/* union without unique sort */
}
SelectStmt
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录