Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
691dc282
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,发现更多精彩内容 >>
提交
691dc282
编写于
1月 19, 1998
作者:
B
Bruce Momjian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix for SELECT INTO TABLE for varchar().
上级
8169769e
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
67 addition
and
5 deletion
+67
-5
src/backend/executor/execMain.c
src/backend/executor/execMain.c
+3
-1
src/backend/executor/execUtils.c
src/backend/executor/execUtils.c
+48
-1
src/include/catalog/pg_attribute.h
src/include/catalog/pg_attribute.h
+9
-1
src/include/catalog/pg_type.h
src/include/catalog/pg_type.h
+4
-1
src/include/executor/executor.h
src/include/executor/executor.h
+3
-1
未找到文件。
src/backend/executor/execMain.c
浏览文件 @
691dc282
...
...
@@ -26,7 +26,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.
39 1998/01/16 23:19:49
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.
40 1998/01/19 02:37:32
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -563,6 +563,8 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
*/
tupdesc
=
CreateTupleDescCopy
(
tupType
);
setAtttypmodForCreateTable
(
tupdesc
,
targetList
,
rangeTable
);
intoRelationId
=
heap_create_with_catalog
(
intoName
,
tupdesc
);
FreeTupleDesc
(
tupdesc
);
...
...
src/backend/executor/execUtils.c
浏览文件 @
691dc282
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.2
4 1998/01/16 23:19:52
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.2
5 1998/01/19 02:37:33
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -1177,3 +1177,50 @@ ExecInsertIndexTuples(TupleTableSlot *slot,
if
(
econtext
!=
NULL
)
pfree
(
econtext
);
}
/* ----------------------------------------------------------------
* setAtttyplenForCreateTable -
* called when we do a SELECT * INTO TABLE tab
* needed for attributes that have atttypmod like bpchar and
* varchar
* ----------------------------------------------------------------
*/
void
setAtttypmodForCreateTable
(
TupleDesc
tupType
,
List
*
targetList
,
List
*
rangeTable
)
{
List
*
tl
;
TargetEntry
*
tle
;
Node
*
expr
;
int
varno
;
tl
=
targetList
;
for
(
varno
=
0
;
varno
<
tupType
->
natts
;
varno
++
)
{
tle
=
lfirst
(
tl
);
if
(
USE_ATTTYPMOD
(
tupType
->
attrs
[
varno
]
->
atttypid
))
{
expr
=
tle
->
expr
;
if
(
expr
&&
IsA
(
expr
,
Var
))
{
Var
*
var
;
RangeTblEntry
*
rtentry
;
Relation
rd
;
var
=
(
Var
*
)
expr
;
rtentry
=
rt_fetch
(
var
->
varnoold
,
rangeTable
);
rd
=
heap_open
(
rtentry
->
relid
);
/* set length to that defined in relation */
tupType
->
attrs
[
varno
]
->
atttypmod
=
(
*
rd
->
rd_att
->
attrs
[
var
->
varoattno
-
1
]).
atttypmod
;
heap_close
(
rd
);
}
else
elog
(
ERROR
,
"setAtttypmodForCreateTable: can't get atttypmod for field (for length, etc.)"
);
}
tl
=
lnext
(
tl
);
}
}
src/include/catalog/pg_attribute.h
浏览文件 @
691dc282
...
...
@@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: pg_attribute.h,v 1.2
2 1998/01/16 23:20:49
momjian Exp $
* $Id: pg_attribute.h,v 1.2
3 1998/01/19 02:37:45
momjian Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
...
...
@@ -89,6 +89,14 @@ CATALOG(pg_attribute) BOOTSTRAP
/*
* atttypmod records type-specific modifications supplied at table
* creation time.
* This is not integrated into all areas of the source. It is in
* TypeName to pass typmod info from the parser during table creation
* time, and it is used in the parser when converting a string to a
* typed constant associated with a variable. We also have a hack in
* execMain.c/execUtils.c that uses atttypmod to properly create tables
* for SELECT * INTO TABLE test2 FROM test;
* One day, we may add this to Resdom, and pass it through all areas.
* 1998/1/18 bjm
*/
bool
attbyval
;
...
...
src/include/catalog/pg_type.h
浏览文件 @
691dc282
...
...
@@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: pg_type.h,v 1.2
6 1997/11/26 04:50
:47 momjian Exp $
* $Id: pg_type.h,v 1.2
7 1998/01/19 02:37
:47 momjian Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
...
...
@@ -364,6 +364,9 @@ DATA(insert OID = 1296 ( timestamp PGUID 4 19 t b t \054 0 0 timestamp_in time
DESCR
(
"limited-range ISO-format date and time"
);
#define TIMESTAMPOID 1296
#define USE_ATTTYPMOD(typeid) ((typeid) == BPCHAROID || (typeid) == VARCHAROID)
/*
* prototypes for functions in pg_type.c
*/
...
...
src/include/executor/executor.h
浏览文件 @
691dc282
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: executor.h,v 1.1
7 1998/01/14 15:48:43
momjian Exp $
* $Id: executor.h,v 1.1
8 1998/01/19 02:37:51
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -120,6 +120,8 @@ extern TupleDesc ExecTypeFromTL(List *targetList);
extern
void
ResetTupleCount
(
void
);
extern
void
ExecAssignNodeBaseInfo
(
EState
*
estate
,
CommonState
*
basenode
,
Plan
*
parent
);
extern
void
setAtttypmodForCreateTable
(
TupleDesc
tupType
,
List
*
targetList
,
List
*
rangeTable
);
extern
void
ExecAssignExprContext
(
EState
*
estate
,
CommonState
*
commonstate
);
extern
void
ExecAssignResultType
(
CommonState
*
commonstate
,
TupleDesc
tupDesc
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录