Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
8b08deb0
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,发现更多精彩内容 >>
提交
8b08deb0
编写于
11月 29, 2011
作者:
B
Bruce Momjian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Simplify the pg_dump/pg_restore error reporting macros, and allow
pg_dumpall to use the same memory allocation functions as the others.
上级
b60f37bf
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
54 addition
and
92 deletion
+54
-92
src/bin/pg_dump/Makefile
src/bin/pg_dump/Makefile
+2
-2
src/bin/pg_dump/dumpmem.c
src/bin/pg_dump/dumpmem.c
+6
-6
src/bin/pg_dump/dumputils.c
src/bin/pg_dump/dumputils.c
+31
-0
src/bin/pg_dump/dumputils.h
src/bin/pg_dump/dumputils.h
+4
-0
src/bin/pg_dump/pg_backup.h
src/bin/pg_dump/pg_backup.h
+0
-4
src/bin/pg_dump/pg_backup_archiver.c
src/bin/pg_dump/pg_backup_archiver.c
+3
-38
src/bin/pg_dump/pg_backup_archiver.h
src/bin/pg_dump/pg_backup_archiver.h
+0
-1
src/bin/pg_dump/pg_backup_custom.c
src/bin/pg_dump/pg_backup_custom.c
+1
-0
src/bin/pg_dump/pg_backup_files.c
src/bin/pg_dump/pg_backup_files.c
+1
-0
src/bin/pg_dump/pg_dump_sort.c
src/bin/pg_dump/pg_dump_sort.c
+4
-3
src/bin/pg_dump/pg_dumpall.c
src/bin/pg_dump/pg_dumpall.c
+1
-38
src/tools/msvc/Mkvcbuild.pm
src/tools/msvc/Mkvcbuild.pm
+1
-0
未找到文件。
src/bin/pg_dump/Makefile
浏览文件 @
8b08deb0
...
...
@@ -35,8 +35,8 @@ pg_dump: pg_dump.o common.o pg_dump_sort.o $(OBJS) $(KEYWRDOBJS) | submake-libpq
pg_restore
:
pg_restore.o $(OBJS) $(KEYWRDOBJS) | submake-libpq submake-libpgport
$(CC)
$(CFLAGS)
pg_restore.o
$(KEYWRDOBJS)
$(OBJS)
$(libpq_pgport)
$(LDFLAGS)
$(LDFLAGS_EX)
$(LIBS)
-o
$@$(X)
pg_dumpall
:
pg_dumpall.o dumputils.o $(KEYWRDOBJS) | submake-libpq submake-libpgport
$(CC)
$(CFLAGS)
pg_dumpall.o dumputils.o
$(KEYWRDOBJS)
$(WIN32RES)
$(libpq_pgport)
$(LDFLAGS)
$(LDFLAGS_EX)
$(LIBS)
-o
$@$(X)
pg_dumpall
:
pg_dumpall.o dumputils.o
dumpmem.o
$(KEYWRDOBJS) | submake-libpq submake-libpgport
$(CC)
$(CFLAGS)
pg_dumpall.o dumputils.o
dumpmem.o
$(KEYWRDOBJS)
$(WIN32RES)
$(libpq_pgport)
$(LDFLAGS)
$(LDFLAGS_EX)
$(LIBS)
-o
$@$(X)
install
:
all installdirs
$(INSTALL_PROGRAM)
pg_dump
$(X)
'
$(DESTDIR)$(bindir)
'
/pg_dump
$(X)
...
...
src/bin/pg_dump/dumpmem.c
浏览文件 @
8b08deb0
...
...
@@ -14,7 +14,7 @@
*-------------------------------------------------------------------------
*/
#include "postgres_fe.h"
#include "
pg_backup
.h"
#include "
dumputils
.h"
#include "dumpmem.h"
#include <ctype.h>
...
...
@@ -32,10 +32,10 @@ pg_strdup(const char *string)
char
*
tmp
;
if
(
!
string
)
exit_horribly
(
NULL
,
NULL
,
"cannot duplicate null pointer
\n
"
);
exit_horribly
(
NULL
,
"cannot duplicate null pointer
\n
"
);
tmp
=
strdup
(
string
);
if
(
!
tmp
)
exit_horribly
(
NULL
,
NULL
,
"out of memory
\n
"
);
exit_horribly
(
NULL
,
"out of memory
\n
"
);
return
tmp
;
}
...
...
@@ -46,7 +46,7 @@ pg_malloc(size_t size)
tmp
=
malloc
(
size
);
if
(
!
tmp
)
exit_horribly
(
NULL
,
NULL
,
"out of memory
\n
"
);
exit_horribly
(
NULL
,
"out of memory
\n
"
);
return
tmp
;
}
...
...
@@ -57,7 +57,7 @@ pg_calloc(size_t nmemb, size_t size)
tmp
=
calloc
(
nmemb
,
size
);
if
(
!
tmp
)
exit_horribly
(
NULL
,
NULL
,
_
(
"out of memory
\n
"
));
exit_horribly
(
NULL
,
_
(
"out of memory
\n
"
));
return
tmp
;
}
...
...
@@ -68,6 +68,6 @@ pg_realloc(void *ptr, size_t size)
tmp
=
realloc
(
ptr
,
size
);
if
(
!
tmp
)
exit_horribly
(
NULL
,
NULL
,
_
(
"out of memory
\n
"
));
exit_horribly
(
NULL
,
_
(
"out of memory
\n
"
));
return
tmp
;
}
src/bin/pg_dump/dumputils.c
浏览文件 @
8b08deb0
...
...
@@ -23,6 +23,7 @@
int
quote_all_identifiers
=
0
;
const
char
*
progname
;
#define supports_grant_options(version) ((version) >= 70400)
...
...
@@ -1211,3 +1212,33 @@ emitShSecLabels(PGconn *conn, PGresult *res, PQExpBuffer buffer,
appendPQExpBuffer
(
buffer
,
";
\n
"
);
}
}
void
write_msg
(
const
char
*
modulename
,
const
char
*
fmt
,...)
{
va_list
ap
;
va_start
(
ap
,
fmt
);
if
(
modulename
)
fprintf
(
stderr
,
"%s: [%s] "
,
progname
,
_
(
modulename
));
else
fprintf
(
stderr
,
"%s: "
,
progname
);
vfprintf
(
stderr
,
_
(
fmt
),
ap
);
va_end
(
ap
);
}
void
exit_horribly
(
const
char
*
modulename
,
const
char
*
fmt
,...)
{
va_list
ap
;
va_start
(
ap
,
fmt
);
write_msg
(
modulename
,
fmt
,
ap
);
va_end
(
ap
);
exit
(
1
);
}
src/bin/pg_dump/dumputils.h
浏览文件 @
8b08deb0
...
...
@@ -51,5 +51,9 @@ extern void buildShSecLabelQuery(PGconn *conn, const char *catalog_name,
uint32
objectId
,
PQExpBuffer
sql
);
extern
void
emitShSecLabels
(
PGconn
*
conn
,
PGresult
*
res
,
PQExpBuffer
buffer
,
const
char
*
target
,
const
char
*
objname
);
extern
void
write_msg
(
const
char
*
modulename
,
const
char
*
fmt
,...)
__attribute__
((
format
(
PG_PRINTF_ATTRIBUTE
,
2
,
3
)));
extern
void
exit_horribly
(
const
char
*
modulename
,
const
char
*
fmt
,...)
__attribute__
((
format
(
PG_PRINTF_ATTRIBUTE
,
2
,
3
)));
#endif
/* DUMPUTILS_H */
src/bin/pg_dump/pg_backup.h
浏览文件 @
8b08deb0
...
...
@@ -150,10 +150,6 @@ typedef struct _restoreOptions
* Main archiver interface.
*/
extern
void
exit_horribly
(
Archive
*
AH
,
const
char
*
modulename
,
const
char
*
fmt
,...)
__attribute__
((
format
(
PG_PRINTF_ATTRIBUTE
,
3
,
4
)));
/* Lets the archive know we have a DB connection to shutdown if it dies */
...
...
src/bin/pg_dump/pg_backup_archiver.c
浏览文件 @
8b08deb0
...
...
@@ -84,8 +84,6 @@ typedef struct _outputContext
int
gzOut
;
}
OutputContext
;
const
char
*
progname
;
static
const
char
*
modulename
=
gettext_noop
(
"archiver"
);
/* index array created by fix_dependencies -- only used in parallel restore */
...
...
@@ -120,7 +118,6 @@ static int _discoverArchiveFormat(ArchiveHandle *AH);
static
int
RestoringToDB
(
ArchiveHandle
*
AH
);
static
void
dump_lo_buf
(
ArchiveHandle
*
AH
);
static
void
_write_msg
(
const
char
*
modulename
,
const
char
*
fmt
,
va_list
ap
)
__attribute__
((
format
(
PG_PRINTF_ATTRIBUTE
,
2
,
0
)));
static
void
_die_horribly
(
ArchiveHandle
*
AH
,
const
char
*
modulename
,
const
char
*
fmt
,
va_list
ap
)
__attribute__
((
format
(
PG_PRINTF_ATTRIBUTE
,
3
,
0
)));
static
void
dumpTimestamp
(
ArchiveHandle
*
AH
,
const
char
*
msg
,
time_t
tim
);
...
...
@@ -1302,7 +1299,7 @@ ahlog(ArchiveHandle *AH, int level, const char *fmt,...)
return
;
va_start
(
ap
,
fmt
);
_
write_msg
(
NULL
,
fmt
,
ap
);
write_msg
(
NULL
,
fmt
,
ap
);
va_end
(
ap
);
}
...
...
@@ -1420,32 +1417,11 @@ ahwrite(const void *ptr, size_t size, size_t nmemb, ArchiveHandle *AH)
}
}
/* Common exit code */
static
void
_write_msg
(
const
char
*
modulename
,
const
char
*
fmt
,
va_list
ap
)
{
if
(
modulename
)
fprintf
(
stderr
,
"%s: [%s] "
,
progname
,
_
(
modulename
));
else
fprintf
(
stderr
,
"%s: "
,
progname
);
vfprintf
(
stderr
,
_
(
fmt
),
ap
);
}
void
write_msg
(
const
char
*
modulename
,
const
char
*
fmt
,...)
{
va_list
ap
;
va_start
(
ap
,
fmt
);
_write_msg
(
modulename
,
fmt
,
ap
);
va_end
(
ap
);
}
static
void
_die_horribly
(
ArchiveHandle
*
AH
,
const
char
*
modulename
,
const
char
*
fmt
,
va_list
ap
)
{
_
write_msg
(
modulename
,
fmt
,
ap
);
write_msg
(
modulename
,
fmt
,
ap
);
if
(
AH
)
{
...
...
@@ -1458,17 +1434,6 @@ _die_horribly(ArchiveHandle *AH, const char *modulename, const char *fmt, va_lis
exit
(
1
);
}
/* External use */
void
exit_horribly
(
Archive
*
AH
,
const
char
*
modulename
,
const
char
*
fmt
,...)
{
va_list
ap
;
va_start
(
ap
,
fmt
);
_die_horribly
((
ArchiveHandle
*
)
AH
,
modulename
,
fmt
,
ap
);
va_end
(
ap
);
}
/* Archiver use (just different arg declaration) */
void
die_horribly
(
ArchiveHandle
*
AH
,
const
char
*
modulename
,
const
char
*
fmt
,...)
...
...
@@ -1524,7 +1489,7 @@ warn_or_die_horribly(ArchiveHandle *AH,
_die_horribly
(
AH
,
modulename
,
fmt
,
ap
);
else
{
_
write_msg
(
modulename
,
fmt
,
ap
);
write_msg
(
modulename
,
fmt
,
ap
);
AH
->
public
.
n_errors
++
;
}
va_end
(
ap
);
...
...
src/bin/pg_dump/pg_backup_archiver.h
浏览文件 @
8b08deb0
...
...
@@ -303,7 +303,6 @@ extern const char *progname;
extern
void
die_horribly
(
ArchiveHandle
*
AH
,
const
char
*
modulename
,
const
char
*
fmt
,...)
__attribute__
((
format
(
PG_PRINTF_ATTRIBUTE
,
3
,
4
)));
extern
void
warn_or_die_horribly
(
ArchiveHandle
*
AH
,
const
char
*
modulename
,
const
char
*
fmt
,...)
__attribute__
((
format
(
PG_PRINTF_ATTRIBUTE
,
3
,
4
)));
extern
void
write_msg
(
const
char
*
modulename
,
const
char
*
fmt
,...)
__attribute__
((
format
(
PG_PRINTF_ATTRIBUTE
,
2
,
3
)));
extern
void
WriteTOC
(
ArchiveHandle
*
AH
);
extern
void
ReadTOC
(
ArchiveHandle
*
AH
);
...
...
src/bin/pg_dump/pg_backup_custom.c
浏览文件 @
8b08deb0
...
...
@@ -25,6 +25,7 @@
*/
#include "compress_io.h"
#include "dumputils.h"
#include "dumpmem.h"
/*--------
...
...
src/bin/pg_dump/pg_backup_files.c
浏览文件 @
8b08deb0
...
...
@@ -26,6 +26,7 @@
*/
#include "pg_backup_archiver.h"
#include "dumputils.h"
#include "dumpmem.h"
static
void
_ArchiveEntry
(
ArchiveHandle
*
AH
,
TocEntry
*
te
);
...
...
src/bin/pg_dump/pg_dump_sort.c
浏览文件 @
8b08deb0
...
...
@@ -14,6 +14,7 @@
*-------------------------------------------------------------------------
*/
#include "pg_backup_archiver.h"
#include "dumputils.h"
#include "dumpmem.h"
static
const
char
*
modulename
=
gettext_noop
(
"sorter"
);
...
...
@@ -315,13 +316,13 @@ TopoSort(DumpableObject **objs,
obj
=
objs
[
i
];
j
=
obj
->
dumpId
;
if
(
j
<=
0
||
j
>
maxDumpId
)
exit_horribly
(
NULL
,
modulename
,
"invalid dumpId %d
\n
"
,
j
);
exit_horribly
(
modulename
,
"invalid dumpId %d
\n
"
,
j
);
idMap
[
j
]
=
i
;
for
(
j
=
0
;
j
<
obj
->
nDeps
;
j
++
)
{
k
=
obj
->
dependencies
[
j
];
if
(
k
<=
0
||
k
>
maxDumpId
)
exit_horribly
(
NULL
,
modulename
,
"invalid dependency %d
\n
"
,
k
);
exit_horribly
(
modulename
,
"invalid dependency %d
\n
"
,
k
);
beforeConstraints
[
k
]
++
;
}
}
...
...
@@ -541,7 +542,7 @@ findDependencyLoops(DumpableObject **objs, int nObjs, int totObjs)
/* We'd better have fixed at least one loop */
if
(
!
fixedloop
)
exit_horribly
(
NULL
,
modulename
,
"could not identify dependency loop
\n
"
);
exit_horribly
(
modulename
,
"could not identify dependency loop
\n
"
);
free
(
workspace
);
}
...
...
src/bin/pg_dump/pg_dumpall.c
浏览文件 @
8b08deb0
...
...
@@ -23,6 +23,7 @@
#include "getopt_long.h"
#include "dumputils.h"
#include "dumpmem.h"
#include "pg_backup.h"
/* version string we expect back from pg_dump */
...
...
@@ -1908,41 +1909,3 @@ doShellQuoting(PQExpBuffer buf, const char *str)
appendPQExpBufferChar
(
buf
,
'"'
);
#endif
/* WIN32 */
}
/*
* Simpler versions of common.c functions.
*/
char
*
pg_strdup
(
const
char
*
string
)
{
char
*
tmp
;
if
(
!
string
)
{
fprintf
(
stderr
,
"cannot duplicate null pointer
\n
"
);
exit
(
1
);
}
tmp
=
strdup
(
string
);
if
(
!
tmp
)
{
fprintf
(
stderr
,
_
(
"%s: out of memory
\n
"
),
progname
);
exit
(
1
);
}
return
tmp
;
}
void
*
pg_malloc
(
size_t
size
)
{
void
*
tmp
;
tmp
=
malloc
(
size
);
if
(
!
tmp
)
{
fprintf
(
stderr
,
_
(
"%s: out of memory
\n
"
),
progname
);
exit
(
1
);
}
return
tmp
;
}
src/tools/msvc/Mkvcbuild.pm
浏览文件 @
8b08deb0
...
...
@@ -355,6 +355,7 @@ sub mkvcbuild
$pgdumpall
->
AddIncludeDir
('
src\backend
');
$pgdumpall
->
AddFile
('
src\bin\pg_dump\pg_dumpall.c
');
$pgdumpall
->
AddFile
('
src\bin\pg_dump\dumputils.c
');
$pgdumpall
->
AddFile
('
src\bin\pg_dump\dumpmem.c
');
$pgdumpall
->
AddFile
('
src\bin\pg_dump\keywords.c
');
$pgdumpall
->
AddFile
('
src\backend\parser\kwlookup.c
');
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录