Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
232d8fa3
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,发现更多精彩内容 >>
提交
232d8fa3
编写于
4月 14, 2001
作者:
P
Philip Warner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
- Get view OID based on rule OID not base table OID
- Fix crash due to null string pointer in some tar files with some libs
上级
83c94a88
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
52 addition
and
24 deletion
+52
-24
src/bin/pg_dump/pg_backup_archiver.c
src/bin/pg_dump/pg_backup_archiver.c
+16
-8
src/bin/pg_dump/pg_backup_archiver.h
src/bin/pg_dump/pg_backup_archiver.h
+2
-2
src/bin/pg_dump/pg_backup_tar.c
src/bin/pg_dump/pg_backup_tar.c
+4
-3
src/bin/pg_dump/pg_dump.c
src/bin/pg_dump/pg_dump.c
+24
-10
src/bin/pg_dump/pg_dump.h
src/bin/pg_dump/pg_dump.h
+6
-1
未找到文件。
src/bin/pg_dump/pg_backup_archiver.c
浏览文件 @
232d8fa3
...
...
@@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.2
3 2001/04/01 05:42:50
pjw Exp $
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.2
4 2001/04/14 13:11:03
pjw Exp $
*
* Modifications - 28-Jun-2000 - pjw@rhyme.com.au
*
...
...
@@ -73,7 +73,7 @@ static int _tocSortCompareByOIDNum(const void *p1, const void *p2);
static
int
_tocSortCompareByIDNum
(
const
void
*
p1
,
const
void
*
p2
);
static
ArchiveHandle
*
_allocAH
(
const
char
*
FileSpec
,
const
ArchiveFormat
fmt
,
const
int
compression
,
ArchiveMode
mode
);
static
int
_printTocEntry
(
ArchiveHandle
*
AH
,
TocEntry
*
te
,
RestoreOptions
*
ropt
);
static
int
_printTocEntry
(
ArchiveHandle
*
AH
,
TocEntry
*
te
,
RestoreOptions
*
ropt
,
bool
isData
);
static
void
_reconnectAsOwner
(
ArchiveHandle
*
AH
,
const
char
*
dbname
,
TocEntry
*
te
);
static
void
_reconnectAsUser
(
ArchiveHandle
*
AH
,
const
char
*
dbname
,
char
*
user
);
...
...
@@ -266,7 +266,7 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
_reconnectAsOwner
(
AH
,
"-"
,
te
);
ahlog
(
AH
,
1
,
"Creating %s %s
\n
"
,
te
->
desc
,
te
->
name
);
_printTocEntry
(
AH
,
te
,
ropt
);
_printTocEntry
(
AH
,
te
,
ropt
,
false
);
/* If we created a DB, connect to it... */
if
(
strcmp
(
te
->
desc
,
"DATABASE"
)
==
0
)
...
...
@@ -286,8 +286,7 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
die_horribly
(
AH
,
"%s: Unable to restore data from a compressed archive
\n
"
,
progname
);
#endif
ahprintf
(
AH
,
"--
\n
-- Data for TOC Entry ID %d (OID %s) %s %s
\n
--
\n\n
"
,
te
->
id
,
te
->
oid
,
te
->
desc
,
te
->
name
);
_printTocEntry
(
AH
,
te
,
ropt
,
true
);
/*
* Maybe we can't do BLOBS, so check if this node is for BLOBS
...
...
@@ -1869,10 +1868,19 @@ _reconnectAsOwner(ArchiveHandle *AH, const char *dbname, TocEntry *te)
}
static
int
_printTocEntry
(
ArchiveHandle
*
AH
,
TocEntry
*
te
,
RestoreOptions
*
ropt
)
_printTocEntry
(
ArchiveHandle
*
AH
,
TocEntry
*
te
,
RestoreOptions
*
ropt
,
bool
isData
)
{
ahprintf
(
AH
,
"--
\n
-- TOC Entry ID %d (OID %s)
\n
--
\n
-- Name: %s Type: %s Owner: %s
\n
"
,
te
->
id
,
te
->
oid
,
te
->
name
,
te
->
desc
,
te
->
owner
);
char
*
pfx
;
if
(
isData
)
{
pfx
=
"Data for "
;
}
else
{
pfx
=
""
;
}
ahprintf
(
AH
,
"--
\n
-- %sTOC Entry ID %d (OID %s)
\n
--
\n
-- Name: %s Type: %s Owner: %s
\n
"
,
pfx
,
te
->
id
,
te
->
oid
,
te
->
name
,
te
->
desc
,
te
->
owner
);
if
(
AH
->
PrintExtraTocPtr
!=
NULL
)
(
*
AH
->
PrintExtraTocPtr
)
(
AH
,
te
);
ahprintf
(
AH
,
"--
\n\n
"
);
...
...
src/bin/pg_dump/pg_backup_archiver.h
浏览文件 @
232d8fa3
...
...
@@ -17,7 +17,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.h,v 1.3
0 2001/04/04 06:47:30
pjw Exp $
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.h,v 1.3
1 2001/04/14 13:11:03
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
2
#define K_VERS_REV
3
/* Data block types */
#define BLK_DATA 1
...
...
src/bin/pg_dump/pg_backup_tar.c
浏览文件 @
232d8fa3
...
...
@@ -16,7 +16,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.1
3 2001/04/01 05:42:51
pjw Exp $
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.1
4 2001/04/14 13:11:03
pjw Exp $
*
* Modifications - 28-Jun-2000 - pjw@rhyme.com.au
*
...
...
@@ -246,7 +246,7 @@ _ArchiveEntry(ArchiveHandle *AH, TocEntry *te)
char
fn
[
K_STD_BUF_SIZE
];
ctx
=
(
lclTocEntry
*
)
malloc
(
sizeof
(
lclTocEntry
));
if
(
te
->
dataDumper
)
if
(
te
->
dataDumper
!=
NULL
)
{
#ifdef HAVE_LIBZ
if
(
AH
->
compression
==
0
)
...
...
@@ -302,7 +302,8 @@ _PrintExtraToc(ArchiveHandle *AH, TocEntry *te)
{
lclTocEntry
*
ctx
=
(
lclTocEntry
*
)
te
->
formatData
;
ahprintf
(
AH
,
"-- File: %s
\n
"
,
ctx
->
filename
);
if
(
ctx
->
filename
!=
NULL
)
ahprintf
(
AH
,
"-- File: %s
\n
"
,
ctx
->
filename
);
}
static
void
...
...
src/bin/pg_dump/pg_dump.c
浏览文件 @
232d8fa3
...
...
@@ -22,7 +22,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.20
1 2001/04/05 02:50:01 tgl
Exp $
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.20
2 2001/04/14 13:11:03 pjw
Exp $
*
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
*
...
...
@@ -2035,9 +2035,14 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
PGresult
*
res2
;
resetPQExpBuffer
(
query
);
appendPQExpBuffer
(
query
,
"SELECT pg_get_viewdef("
);
appendPQExpBuffer
(
query
,
"SELECT definition as viewdef, "
);
/* XXX 7.2 - replace with att from pg_views or some other generic source */
appendPQExpBuffer
(
query
,
"(select oid from pg_rewrite where rulename='_RET'"
" || viewname) as view_oid from pg_views"
" where viewname = "
);
formatStringLiteral
(
query
,
tblinfo
[
i
].
relname
,
CONV_ALL
);
appendPQExpBuffer
(
query
,
") as viewdef"
);
appendPQExpBuffer
(
query
,
";"
);
res2
=
PQexec
(
g_conn
,
query
->
data
);
if
(
!
res2
||
PQresultStatus
(
res2
)
!=
PGRES_TUPLES_OK
)
{
...
...
@@ -2051,18 +2056,26 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
{
if
(
PQntuples
(
res2
)
<
1
)
{
fprintf
(
stderr
,
"getTables(): SELECT (for VIEW %s) returned no definitions"
,
fprintf
(
stderr
,
"getTables(): SELECT (for VIEW %s) returned no definitions
\n
"
,
tblinfo
[
i
].
relname
);
}
else
{
fprintf
(
stderr
,
"getTables(): SELECT (for VIEW %s) returned more than 1 definition"
,
fprintf
(
stderr
,
"getTables(): SELECT (for VIEW %s) returned more than 1 definition
\n
"
,
tblinfo
[
i
].
relname
);
}
exit_nicely
(
g_conn
);
}
if
(
PQgetisnull
(
res2
,
0
,
1
))
{
fprintf
(
stderr
,
"getTables(): SELECT (for VIEW %s) returned NULL oid
\n
"
,
tblinfo
[
i
].
relname
);
fprintf
(
stderr
,
"SELECT was: %s
\n
"
,
query
->
data
);
exit_nicely
(
g_conn
);
}
tblinfo
[
i
].
viewdef
=
strdup
(
PQgetvalue
(
res2
,
0
,
0
));
tblinfo
[
i
].
viewoid
=
strdup
(
PQgetvalue
(
res2
,
0
,
1
));
if
(
strlen
(
tblinfo
[
i
].
viewdef
)
==
0
)
{
...
...
@@ -3739,6 +3752,7 @@ dumpTables(Archive *fout, TableInfo *tblinfo, int numTables,
int
numParents
;
int
actual_atts
;
/* number of attrs in this CREATE statment */
char
*
reltypename
;
char
*
objoid
;
/* First - dump SEQUENCEs */
if
(
tablename
&&
strlen
(
tablename
)
>
0
)
...
...
@@ -3778,15 +3792,15 @@ dumpTables(Archive *fout, TableInfo *tblinfo, int numTables,
if
(
tblinfo
[
i
].
viewdef
!=
NULL
)
{
reltypename
=
"VIEW"
;
objoid
=
tblinfo
[
i
].
viewoid
;
appendPQExpBuffer
(
delq
,
"DROP VIEW %s;
\n
"
,
fmtId
(
tblinfo
[
i
].
relname
,
force_quotes
));
appendPQExpBuffer
(
q
,
"CREATE VIEW %s as %s"
,
fmtId
(
tblinfo
[
i
].
relname
,
force_quotes
),
tblinfo
[
i
].
viewdef
);
appendPQExpBuffer
(
q
,
"CREATE VIEW %s as %s
\n
"
,
fmtId
(
tblinfo
[
i
].
relname
,
force_quotes
),
tblinfo
[
i
].
viewdef
);
}
else
{
reltypename
=
"TABLE"
;
objoid
=
tblinfo
[
i
].
oid
;
parentRels
=
tblinfo
[
i
].
parentRels
;
numParents
=
tblinfo
[
i
].
numParents
;
...
...
@@ -3883,7 +3897,7 @@ dumpTables(Archive *fout, TableInfo *tblinfo, int numTables,
if
(
!
dataOnly
)
{
ArchiveEntry
(
fout
,
tblinfo
[
i
].
oid
,
tblinfo
[
i
].
relname
,
ArchiveEntry
(
fout
,
obj
oid
,
tblinfo
[
i
].
relname
,
reltypename
,
NULL
,
q
->
data
,
delq
->
data
,
""
,
tblinfo
[
i
].
usename
,
NULL
,
NULL
);
...
...
@@ -4323,7 +4337,7 @@ findLastBuiltinOid(const char *dbname)
if
(
res
==
NULL
||
PQresultStatus
(
res
)
!=
PGRES_TUPLES_OK
)
{
fprintf
(
stderr
,
"pg_dump: error in finding the last system OID"
);
fprintf
(
stderr
,
"pg_dump: error in finding the last system OID
.
"
);
fprintf
(
stderr
,
"Explanation from backend: '%s'.
\n
"
,
PQerrorMessage
(
g_conn
));
exit_nicely
(
g_conn
);
}
...
...
src/bin/pg_dump/pg_dump.h
浏览文件 @
232d8fa3
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: pg_dump.h,v 1.6
1 2001/04/03 08:52:59
pjw Exp $
* $Id: pg_dump.h,v 1.6
2 2001/04/14 13:11:03
pjw Exp $
*
* Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2
*
...
...
@@ -88,6 +88,11 @@ typedef struct _tableInfo
char
*
relname
;
char
*
relacl
;
char
*
viewdef
;
char
*
viewoid
;
/* OID of view - should be >= oid of table
* important because views may be constructed
* manually from rules, and rule may ref things
* created after the base table was created.
*/
bool
sequence
;
int
numatts
;
/* number of attributes */
int
*
inhAttrs
;
/* an array of flags, one for each
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录