Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
33b4ad66
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,发现更多精彩内容 >>
提交
33b4ad66
编写于
6月 27, 2006
作者:
B
Bruce Momjian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert patch, doesn't do what it should:
* %Disallow changing default expression of a SERIAL column Dhanaraj M
上级
cdd5178c
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
14 addition
and
151 deletion
+14
-151
doc/TODO
doc/TODO
+5
-1
doc/src/FAQ/TODO.html
doc/src/FAQ/TODO.html
+4
-1
src/backend/catalog/dependency.c
src/backend/catalog/dependency.c
+1
-87
src/backend/catalog/heap.c
src/backend/catalog/heap.c
+1
-48
src/backend/commands/tablecmds.c
src/backend/commands/tablecmds.c
+1
-6
src/include/catalog/dependency.h
src/include/catalog/dependency.h
+1
-4
src/include/catalog/heap.h
src/include/catalog/heap.h
+1
-4
未找到文件。
doc/TODO
浏览文件 @
33b4ad66
...
...
@@ -208,7 +208,11 @@ Data Types
The positive modulus result returned by NUMERICs might be considered
inaccurate, in one sense.
* -Disallow changing DEFAULT expression of a SERIAL column
* %Disallow changing DEFAULT expression of a SERIAL column?
This should be done only if the existing SERIAL problems cannot be
fixed.
* %Disallow ALTER SEQUENCE changes for SERIAL sequences because pg_dump
does not dump the changes
* Fix data types where equality comparison isn't intuitive, e.g. box
...
...
doc/src/FAQ/TODO.html
浏览文件 @
33b4ad66
...
...
@@ -190,7 +190,10 @@ first.
inaccurate, in one sense.
</p>
<ul>
<li>
-
<em>
Disallow changing DEFAULT expression of a SERIAL column
</em>
<li>
%Disallow changing DEFAULT expression of a SERIAL column?
<p>
This should be done only if the existing SERIAL problems cannot be
fixed.
</p>
</li><li>
%Disallow ALTER SEQUENCE changes for SERIAL sequences because pg_dump
does not dump the changes
</li><li>
Fix data types where equality comparison isn't intuitive, e.g. box
...
...
src/backend/catalog/dependency.c
浏览文件 @
33b4ad66
...
...
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/catalog/dependency.c,v 1.5
5 2006/06/27 03:21:54
momjian Exp $
* $PostgreSQL: pgsql/src/backend/catalog/dependency.c,v 1.5
6 2006/06/27 18:35:05
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -1927,89 +1927,3 @@ getRelationDescription(StringInfo buffer, Oid relid)
ReleaseSysCache
(
relTup
);
}
/* Recursively travel and search for the default sequence. Finally detach it */
void
performSequenceDefaultDeletion
(
const
ObjectAddress
*
object
,
DropBehavior
behavior
,
int
deleteFlag
)
{
ScanKeyData
key
[
3
];
int
nkeys
;
SysScanDesc
scan
;
HeapTuple
tup
;
ObjectAddress
otherObject
;
Relation
depRel
;
depRel
=
heap_open
(
DependRelationId
,
RowExclusiveLock
);
ScanKeyInit
(
&
key
[
0
],
Anum_pg_depend_classid
,
BTEqualStrategyNumber
,
F_OIDEQ
,
ObjectIdGetDatum
(
object
->
classId
));
ScanKeyInit
(
&
key
[
1
],
Anum_pg_depend_objid
,
BTEqualStrategyNumber
,
F_OIDEQ
,
ObjectIdGetDatum
(
object
->
objectId
));
if
(
object
->
objectSubId
!=
0
)
{
ScanKeyInit
(
&
key
[
2
],
Anum_pg_depend_objsubid
,
BTEqualStrategyNumber
,
F_INT4EQ
,
Int32GetDatum
(
object
->
objectSubId
));
nkeys
=
3
;
}
else
nkeys
=
2
;
scan
=
systable_beginscan
(
depRel
,
DependDependerIndexId
,
true
,
SnapshotNow
,
nkeys
,
key
);
while
(
HeapTupleIsValid
(
tup
=
systable_getnext
(
scan
)))
{
Form_pg_depend
foundDep
=
(
Form_pg_depend
)
GETSTRUCT
(
tup
);
otherObject
.
classId
=
foundDep
->
refclassid
;
otherObject
.
objectId
=
foundDep
->
refobjid
;
otherObject
.
objectSubId
=
foundDep
->
refobjsubid
;
/* Detach the default sequence from the relation */
if
(
deleteFlag
==
1
)
{
simple_heap_delete
(
depRel
,
&
tup
->
t_self
);
break
;
}
switch
(
foundDep
->
deptype
)
{
case
DEPENDENCY_NORMAL
:
{
if
(
getObjectClass
(
&
otherObject
)
==
OCLASS_CLASS
)
{
/* Dont allow to change the default sequence */
if
(
deleteFlag
==
2
)
{
systable_endscan
(
scan
);
heap_close
(
depRel
,
RowExclusiveLock
);
elog
(
ERROR
,
"%s is a SERIAL sequence. Can't alter the relation"
,
getObjectDescription
(
&
otherObject
));
return
;
}
else
/* Detach the default sequence from the relation */
{
performSequenceDefaultDeletion
(
&
otherObject
,
behavior
,
1
);
systable_endscan
(
scan
);
heap_close
(
depRel
,
RowExclusiveLock
);
return
;
}
}
}
}
}
systable_endscan
(
scan
);
heap_close
(
depRel
,
RowExclusiveLock
);
}
src/backend/catalog/heap.c
浏览文件 @
33b4ad66
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.30
0 2006/06/27 03:21:54
momjian Exp $
* $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.30
1 2006/06/27 18:35:05
momjian Exp $
*
*
* INTERFACE ROUTINES
...
...
@@ -2133,50 +2133,3 @@ heap_truncate_find_FKs(List *relationIds)
return
result
;
}
/* Detach the default sequence and the relation */
void
RemoveSequenceDefault
(
Oid
relid
,
AttrNumber
attnum
,
DropBehavior
behavior
,
bool
flag
)
{
Relation
attrdef_rel
;
ScanKeyData
scankeys
[
2
];
SysScanDesc
scan
;
HeapTuple
tuple
;
attrdef_rel
=
heap_open
(
AttrDefaultRelationId
,
RowExclusiveLock
);
ScanKeyInit
(
&
scankeys
[
0
],
Anum_pg_attrdef_adrelid
,
BTEqualStrategyNumber
,
F_OIDEQ
,
ObjectIdGetDatum
(
relid
));
ScanKeyInit
(
&
scankeys
[
1
],
Anum_pg_attrdef_adnum
,
BTEqualStrategyNumber
,
F_INT2EQ
,
Int16GetDatum
(
attnum
));
scan
=
systable_beginscan
(
attrdef_rel
,
AttrDefaultIndexId
,
true
,
SnapshotNow
,
2
,
scankeys
);
/* There should be at most one matching tuple, but we loop anyway */
while
(
HeapTupleIsValid
(
tuple
=
systable_getnext
(
scan
)))
{
ObjectAddress
object
;
object
.
classId
=
AttrDefaultRelationId
;
object
.
objectId
=
HeapTupleGetOid
(
tuple
);
object
.
objectSubId
=
0
;
if
(
flag
==
true
)
/* Detach the sequence */
performSequenceDefaultDeletion
(
&
object
,
behavior
,
0
);
else
/* Don't allow to change the default sequence */
performSequenceDefaultDeletion
(
&
object
,
behavior
,
2
);
}
systable_endscan
(
scan
);
heap_close
(
attrdef_rel
,
RowExclusiveLock
);
}
src/backend/commands/tablecmds.c
浏览文件 @
33b4ad66
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.18
7 2006/06/27 03:43:19
momjian Exp $
* $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.18
8 2006/06/27 18:35:05
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -3404,11 +3404,6 @@ ATExecColumnDefault(Relation rel, const char *colName,
* safety, but at present we do not expect anything to depend on the
* default.
*/
if
(
newDefault
)
RemoveSequenceDefault
(
RelationGetRelid
(
rel
),
attnum
,
DROP_RESTRICT
,
false
);
else
RemoveSequenceDefault
(
RelationGetRelid
(
rel
),
attnum
,
DROP_RESTRICT
,
true
);
RemoveAttrDefault
(
RelationGetRelid
(
rel
),
attnum
,
DROP_RESTRICT
,
false
);
if
(
newDefault
)
...
...
src/include/catalog/dependency.h
浏览文件 @
33b4ad66
...
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/catalog/dependency.h,v 1.2
4 2006/06/27 03:21:5
5 momjian Exp $
* $PostgreSQL: pgsql/src/include/catalog/dependency.h,v 1.2
5 2006/06/27 18:35:0
5 momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -207,7 +207,4 @@ extern void shdepDropOwned(List *relids, DropBehavior behavior);
extern
void
shdepReassignOwned
(
List
*
relids
,
Oid
newrole
);
extern
void
performSequenceDefaultDeletion
(
const
ObjectAddress
*
object
,
DropBehavior
behavior
,
int
deleteFlag
);
#endif
/* DEPENDENCY_H */
src/include/catalog/heap.h
浏览文件 @
33b4ad66
...
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/catalog/heap.h,v 1.8
1 2006/06/27 03:21:5
5 momjian Exp $
* $PostgreSQL: pgsql/src/include/catalog/heap.h,v 1.8
2 2006/06/27 18:35:0
5 momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -97,7 +97,4 @@ extern void CheckAttributeNamesTypes(TupleDesc tupdesc, char relkind);
extern
void
CheckAttributeType
(
const
char
*
attname
,
Oid
atttypid
);
extern
void
RemoveSequenceDefault
(
Oid
relid
,
AttrNumber
attnum
,
DropBehavior
behavior
,
bool
flag
);
#endif
/* HEAP_H */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录