Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
a51d560d
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,发现更多精彩内容 >>
提交
a51d560d
编写于
4月 04, 2001
作者:
P
Philip Warner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Don't dump CHECK constraints with same source and names both
starting with '$'.
上级
1d9819d6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
30 addition
and
61 deletion
+30
-61
src/bin/pg_dump/pg_backup_archiver.h
src/bin/pg_dump/pg_backup_archiver.h
+2
-2
src/bin/pg_dump/pg_dump.c
src/bin/pg_dump/pg_dump.c
+28
-59
未找到文件。
src/bin/pg_dump/pg_backup_archiver.h
浏览文件 @
a51d560d
...
...
@@ -17,7 +17,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.h,v 1.
29 2001/04/03 08:52:59
pjw Exp $
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.h,v 1.
30 2001/04/04 06:47:30
pjw Exp $
*
* Modifications - 28-Jun-2000 - pjw@rhyme.com.au
* - Initial version.
...
...
@@ -68,7 +68,7 @@ typedef z_stream *z_streamp;
#define K_VERS_MAJOR 1
#define K_VERS_MINOR 5
#define K_VERS_REV
1
#define K_VERS_REV
2
/* Data block types */
#define BLK_DATA 1
...
...
src/bin/pg_dump/pg_dump.c
浏览文件 @
a51d560d
...
...
@@ -22,7 +22,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.
199 2001/04/03 08:52:59
pjw Exp $
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.
200 2001/04/04 06:47:30
pjw Exp $
*
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
*
...
...
@@ -122,6 +122,11 @@
* OID of the type functions, but type must be created after
* the functions.
*
* Modifications - 4-Apr-2001 - pjw@rhyme.com.au
*
* - Don't dump CHECK constraints with same source and names both
* starting with '$'.
*
*-------------------------------------------------------------------------
*/
...
...
@@ -2068,59 +2073,15 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
else
tblinfo
[
i
].
viewdef
=
NULL
;
/*
/*
* Get non-inherited CHECK constraints, if any.
*
* Exclude inherited CHECKs from CHECK constraints total. If a
* constraint matches by name and condition with a constraint
* belonging to a parent class, we assume it was inherited.
* belonging to a parent class (OR conditions match and both
* names start with '$', we assume it was inherited.
*/
if
(
tblinfo
[
i
].
ncheck
>
0
)
{
PGresult
*
res2
;
int
ntups2
;
if
(
g_verbose
)
fprintf
(
stderr
,
"%s excluding inherited CHECK constraints "
"for relation: '%s' %s
\n
"
,
g_comment_start
,
tblinfo
[
i
].
relname
,
g_comment_end
);
/*
* XXXX: Use LOJ maybe - need to compare with subsequent query
* for non-inherited
*/
resetPQExpBuffer
(
query
);
appendPQExpBuffer
(
query
,
"SELECT rcname from pg_relcheck, pg_inherits as i "
"where rcrelid = '%s'::oid "
" and rcrelid = i.inhrelid"
" and exists "
" (select * from pg_relcheck as c "
" where c.rcname = pg_relcheck.rcname "
" and c.rcsrc = pg_relcheck.rcsrc "
" and c.rcrelid = i.inhparent) "
,
tblinfo
[
i
].
oid
);
res2
=
PQexec
(
g_conn
,
query
->
data
);
if
(
!
res2
||
PQresultStatus
(
res2
)
!=
PGRES_TUPLES_OK
)
{
fprintf
(
stderr
,
"getTables(): SELECT (for inherited CHECK) failed. "
"Explanation from backend: '%s'.
\n
"
,
PQerrorMessage
(
g_conn
));
exit_nicely
(
g_conn
);
}
ntups2
=
PQntuples
(
res2
);
tblinfo
[
i
].
ncheck
-=
ntups2
;
if
(
tblinfo
[
i
].
ncheck
<
0
)
{
fprintf
(
stderr
,
"getTables(): found more inherited CHECKs than total for "
"relation %s
\n
"
,
tblinfo
[
i
].
relname
);
exit_nicely
(
g_conn
);
}
PQclear
(
res2
);
}
/* Get non-inherited CHECK constraints, if any */
if
(
tblinfo
[
i
].
ncheck
>
0
)
{
PGresult
*
res2
;
int
i_rcname
,
...
...
@@ -2136,13 +2097,16 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
resetPQExpBuffer
(
query
);
appendPQExpBuffer
(
query
,
"SELECT rcname, rcsrc from pg_relcheck "
"where rcrelid = '%s'::oid "
"
where rcrelid = '%s'::oid "
" and not exists "
" (select * from pg_relcheck as c, pg_inherits as i "
" where i.inhrelid = pg_relcheck.rcrelid "
" and c.rcname = pg_relcheck.rcname "
" and c.rcsrc = pg_relcheck.rcsrc "
" and c.rcrelid = i.inhparent) "
" (select * from pg_relcheck as c, pg_inherits as i "
" where i.inhrelid = pg_relcheck.rcrelid "
" and (c.rcname = pg_relcheck.rcname "
" or ( c.rcname[0] = '$' "
" and pg_relcheck.rcname[0] = '$')"
" )"
" and c.rcsrc = pg_relcheck.rcsrc "
" and c.rcrelid = i.inhparent) "
" Order By oid "
,
tblinfo
[
i
].
oid
);
res2
=
PQexec
(
g_conn
,
query
->
data
);
...
...
@@ -2154,12 +2118,17 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
exit_nicely
(
g_conn
);
}
ntups2
=
PQntuples
(
res2
);
if
(
ntups2
!=
tblinfo
[
i
].
ncheck
)
if
(
ntups2
>
tblinfo
[
i
].
ncheck
)
{
fprintf
(
stderr
,
"getTables(): relation '%s': %d CHECKs were expected, but got %d
\n
"
,
fprintf
(
stderr
,
"getTables(): relation '%s': a maximum of %d CHECKs "
"were expected, but got %d
\n
"
,
tblinfo
[
i
].
relname
,
tblinfo
[
i
].
ncheck
,
ntups2
);
exit_nicely
(
g_conn
);
}
/* Set ncheck to the number of *non-inherited* CHECK constraints */
tblinfo
[
i
].
ncheck
=
ntups2
;
i_rcname
=
PQfnumber
(
res2
,
"rcname"
);
i_rcsrc
=
PQfnumber
(
res2
,
"rcsrc"
);
tblinfo
[
i
].
check_expr
=
(
char
**
)
malloc
(
ntups2
*
sizeof
(
char
*
));
...
...
@@ -3897,7 +3866,7 @@ dumpTables(Archive *fout, TableInfo *tblinfo, int numTables,
if
(
numParents
>
0
)
{
appendPQExpBuffer
(
q
,
"
\n
inherits
("
);
appendPQExpBuffer
(
q
,
"
\n
INHERITS
("
);
for
(
k
=
0
;
k
<
numParents
;
k
++
)
{
appendPQExpBuffer
(
q
,
"%s%s"
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录