Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
600c958a
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,发现更多精彩内容 >>
提交
600c958a
编写于
1月 11, 1998
作者:
B
Bruce Momjian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add UNION, GROUP, DISTINCT to INSERT.
上级
d70df16a
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
46 addition
and
10 deletion
+46
-10
src/backend/parser/analyze.c
src/backend/parser/analyze.c
+20
-2
src/backend/parser/gram.y
src/backend/parser/gram.y
+17
-6
src/include/nodes/parsenodes.h
src/include/nodes/parsenodes.h
+6
-1
src/man/insert.l
src/man/insert.l
+3
-1
未找到文件。
src/backend/parser/analyze.c
浏览文件 @
600c958a
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.6
3 1998/01/10 04:29:47
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.6
4 1998/01/11 03:41:35
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -241,7 +241,7 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt)
/* set up a range table */
makeRangeTable
(
pstate
,
stmt
->
relname
,
stmt
->
fromClause
);
qry
->
uniqueFlag
=
NULL
;
qry
->
uniqueFlag
=
stmt
->
unique
;
/* fix the target list */
icolumns
=
pstate
->
p_insert_columns
=
makeTargetNames
(
pstate
,
stmt
->
cols
);
...
...
@@ -315,13 +315,31 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt)
/* fix where clause */
qry
->
qual
=
transformWhereClause
(
pstate
,
stmt
->
whereClause
);
/* check having clause */
if
(
stmt
->
havingClause
)
elog
(
NOTICE
,
"HAVING not yet supported; ignore clause"
,
NULL
);
/* now the range table will not change */
qry
->
rtable
=
pstate
->
p_rtable
;
qry
->
resultRelation
=
refnameRangeTablePosn
(
pstate
->
p_rtable
,
stmt
->
relname
);
qry
->
groupClause
=
transformGroupClause
(
pstate
,
stmt
->
groupClause
,
qry
->
targetList
);
/* fix order clause */
qry
->
sortClause
=
transformSortClause
(
pstate
,
NIL
,
NIL
,
qry
->
targetList
,
qry
->
uniqueFlag
);
if
(
pstate
->
p_numAgg
>
0
)
finalizeAggregates
(
pstate
,
qry
);
qry
->
unionall
=
stmt
->
unionall
;
/* in child, so unionClause may be false */
qry
->
unionClause
=
transformUnionClause
(
stmt
->
unionClause
,
qry
->
targetList
);
return
(
Query
*
)
qry
;
}
...
...
src/backend/parser/gram.y
浏览文件 @
600c958a
...
...
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.8
8 1998/01/10 04:29:50
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.8
9 1998/01/11 03:41:38
momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
...
...
@@ -2146,16 +2146,27 @@ InsertStmt: INSERT INTO relation_name opt_column_list insert_rest
insert_rest: VALUES '(' res_target_list2 ')'
{
$$ = makeNode(InsertStmt);
$$->unique = NULL;
$$->targetList = $3;
$$->fromClause = NIL;
$$->whereClause = NULL;
$$->whereClause = NIL;
$$->groupClause = NIL;
$$->havingClause = NIL;
$$->unionClause = NIL;
}
| SELECT res_target_list2 from_clause where_clause
| SELECT opt_unique res_target_list2
from_clause where_clause
group_clause having_clause
union_clause
{
$$ = makeNode(InsertStmt);
$$->targetList = $2;
$$->fromClause = $3;
$$->whereClause = $4;
$$->unique = $2;
$$->targetList = $3;
$$->fromClause = $4;
$$->whereClause = $5;
$$->groupClause = $6;
$$->havingClause = $7;
$$->unionClause = $8;
}
;
...
...
src/include/nodes/parsenodes.h
浏览文件 @
600c958a
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: parsenodes.h,v 1.4
2 1998/01/10 04:30:11
momjian Exp $
* $Id: parsenodes.h,v 1.4
3 1998/01/11 03:41:49
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -574,10 +574,15 @@ typedef struct InsertStmt
{
NodeTag
type
;
char
*
relname
;
/* relation to insert into */
char
*
unique
;
/* NULL, '*', or unique attribute name */
List
*
cols
;
/* names of the columns */
List
*
targetList
;
/* the target list (of ResTarget) */
List
*
fromClause
;
/* the from clause */
Node
*
whereClause
;
/* qualifications */
List
*
groupClause
;
/* group by clause */
Node
*
havingClause
;
/* having conditional-expression */
List
*
unionClause
;
/* union subselect parameters */
bool
unionall
;
/* union without unique sort */
}
InsertStmt
;
/* ----------------------
...
...
src/man/insert.l
浏览文件 @
600c958a
.\" This is -*-nroff-*-
.\" XXX standard disclaimer belongs here....
.\" $Header: /cvsroot/pgsql/src/man/Attic/insert.l,v 1.
5 1997/09/27 03:14:19
momjian Exp $
.\" $Header: /cvsroot/pgsql/src/man/Attic/insert.l,v 1.
6 1998/01/11 03:41:57
momjian Exp $
.TH INSERT SQL 11/05/95 PostgreSQL PostgreSQL
.SH NAME
insert \(em insert tuples to a relation
...
...
@@ -11,6 +11,8 @@ insert \(em insert tuples to a relation
{\fBvalues\fR (expression1 [,expression-i] ) |
\fBselect\fR expression1 [,expression-i]
[\fBfrom\fR from-list] [\fBwhere\fR qual]
[\fBgroup by\fR attr_name1 {, attr_name-i....}]
[\fBunion {all} select\fR ...]
.fi
.SH DESCRIPTION
.BR Insert
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录