Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
412cb388
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,发现更多精彩内容 >>
提交
412cb388
编写于
1月 10, 2001
作者:
T
Tom Lane
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Do The Right Thing (tm) if asked to cluster a temp table. Previous
code would cluster, but table would magically lose its tempness.
上级
353f71a3
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
17 addition
and
8 deletion
+17
-8
src/backend/commands/cluster.c
src/backend/commands/cluster.c
+17
-8
未找到文件。
src/backend/commands/cluster.c
浏览文件 @
412cb388
...
...
@@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.6
1 2001/01/01 21:35:00
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.6
2 2001/01/10 01:12:28
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -34,8 +34,10 @@
#include "miscadmin.h"
#include "utils/builtins.h"
#include "utils/syscache.h"
#include "utils/temprel.h"
static
Oid
copy_heap
(
Oid
OIDOldHeap
,
char
*
NewName
);
static
Oid
copy_heap
(
Oid
OIDOldHeap
,
char
*
NewName
,
bool
istemp
);
static
void
copy_index
(
Oid
OIDOldIndex
,
Oid
OIDNewHeap
,
char
*
NewIndexName
);
static
void
rebuildheap
(
Oid
OIDNewHeap
,
Oid
OIDOldHeap
,
Oid
OIDOldIndex
);
...
...
@@ -60,6 +62,7 @@ cluster(char *oldrelname, char *oldindexname)
Relation
OldHeap
,
OldIndex
;
HeapTuple
tuple
;
bool
istemp
;
char
NewHeapName
[
NAMEDATALEN
];
char
NewIndexName
[
NAMEDATALEN
];
char
saveoldrelname
[
NAMEDATALEN
];
...
...
@@ -82,6 +85,8 @@ cluster(char *oldrelname, char *oldindexname)
LockRelation
(
OldIndex
,
AccessExclusiveLock
);
OIDOldIndex
=
RelationGetRelid
(
OldIndex
);
istemp
=
is_temp_rel_name
(
saveoldrelname
);
/*
* Check that index is in fact an index on the given relation
*/
...
...
@@ -105,7 +110,7 @@ cluster(char *oldrelname, char *oldindexname)
*/
snprintf
(
NewHeapName
,
NAMEDATALEN
,
"temp_%u"
,
OIDOldHeap
);
OIDNewHeap
=
copy_heap
(
OIDOldHeap
,
NewHeapName
);
OIDNewHeap
=
copy_heap
(
OIDOldHeap
,
NewHeapName
,
istemp
);
/* We do not need CommandCounterIncrement() because copy_heap did it. */
...
...
@@ -138,7 +143,7 @@ cluster(char *oldrelname, char *oldindexname)
}
static
Oid
copy_heap
(
Oid
OIDOldHeap
,
char
*
NewName
)
copy_heap
(
Oid
OIDOldHeap
,
char
*
NewName
,
bool
istemp
)
{
TupleDesc
OldHeapDesc
,
tupdesc
;
...
...
@@ -155,7 +160,7 @@ copy_heap(Oid OIDOldHeap, char *NewName)
tupdesc
=
CreateTupleDescCopy
(
OldHeapDesc
);
OIDNewHeap
=
heap_create_with_catalog
(
NewName
,
tupdesc
,
RELKIND_RELATION
,
false
,
RELKIND_RELATION
,
istemp
,
allowSystemTableMods
);
/*
...
...
@@ -192,9 +197,13 @@ copy_index(Oid OIDOldIndex, Oid OIDNewHeap, char *NewIndexName)
OldIndex
=
index_open
(
OIDOldIndex
);
/*
* Create a new (temporary) index like the one that's already here.
* To do this I get the info from pg_index, and add a new index with
* a temporary name.
* Create a new index like the old one. To do this I get the info
* from pg_index, and add a new index with a temporary name (that
* will be changed later).
*
* NOTE: index_create will cause the new index to be a temp relation
* if its parent table is, so we don't need to do anything special
* for the temp-table case here.
*/
Old_pg_index_Tuple
=
SearchSysCache
(
INDEXRELID
,
ObjectIdGetDatum
(
OIDOldIndex
),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录