Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
9b35ec26
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,发现更多精彩内容 >>
提交
9b35ec26
编写于
5月 26, 1999
作者:
B
Bruce Momjian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Disable use of -o and -d pg_dump options together. Can't set oids in
inserts. Change some variables to bool to be clearer.
上级
9c56b408
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
38 addition
and
30 deletion
+38
-30
src/bin/pg_dump/pg_dump.c
src/bin/pg_dump/pg_dump.c
+38
-30
未找到文件。
src/bin/pg_dump/pg_dump.c
浏览文件 @
9b35ec26
...
...
@@ -21,7 +21,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.1
09 1999/05/26 14:50:38
momjian Exp $
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.1
10 1999/05/26 16:06:45
momjian Exp $
*
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
*
...
...
@@ -112,12 +112,12 @@ FILE *g_fout; /* the script file */
PGconn
*
g_conn
;
/* the database connection */
bool
force_quotes
;
/* User wants to suppress double-quotes */
int
dumpData
;
/* dump data using proper insert strings */
int
attrNames
;
/* put attr names into insert strings */
int
schemaOnly
;
int
dataOnly
;
int
aclsOption
;
bool
drop
_s
chema
;
bool
dumpData
;
/* dump data using proper insert strings */
bool
attrNames
;
/* put attr names into insert strings */
bool
schemaOnly
;
bool
dataOnly
;
bool
aclsOption
;
bool
drop
S
chema
;
char
g_opaque_type
[
10
];
/* name for the opaque type */
...
...
@@ -233,7 +233,7 @@ dumpClasses_nodumpData(FILE *fout, const char *classname, const bool oids)
bool
copydone
;
char
copybuf
[
COPYBUFSIZ
];
if
(
oids
)
if
(
oids
==
true
)
{
fprintf
(
fout
,
"COPY %s WITH OIDS FROM stdin;
\n
"
,
fmtId
(
classname
,
force_quotes
));
...
...
@@ -336,7 +336,7 @@ dumpClasses_dumpData(FILE *fout, const char *classname,
for
(
tuple
=
0
;
tuple
<
PQntuples
(
res
);
tuple
++
)
{
fprintf
(
fout
,
"INSERT INTO %s "
,
fmtId
(
classname
,
force_quotes
));
if
(
attrNames
)
if
(
attrNames
==
true
)
{
sprintf
(
q
,
"("
);
for
(
field
=
0
;
field
<
PQnfields
(
res
);
field
++
)
...
...
@@ -545,7 +545,7 @@ main(int argc, char **argv)
const
char
*
pghost
=
NULL
;
const
char
*
pgport
=
NULL
;
char
*
tablename
=
NULL
;
int
oids
=
0
;
bool
oids
=
false
;
TableInfo
*
tblinfo
;
int
numTables
;
char
connect_string
[
512
]
=
""
;
...
...
@@ -556,13 +556,13 @@ main(int argc, char **argv)
g_verbose
=
false
;
force_quotes
=
true
;
drop
_s
chema
=
false
;
drop
S
chema
=
false
;
strcpy
(
g_comment_start
,
"-- "
);
g_comment_end
[
0
]
=
'\0'
;
strcpy
(
g_opaque_type
,
"opaque"
);
dataOnly
=
schemaOnly
=
dumpData
=
attrNames
=
0
;
dataOnly
=
schemaOnly
=
dumpData
=
attrNames
=
false
;
progname
=
*
argv
;
...
...
@@ -571,19 +571,19 @@ main(int argc, char **argv)
switch
(
c
)
{
case
'a'
:
/* Dump data only */
dataOnly
=
1
;
dataOnly
=
true
;
break
;
case
'c'
:
/* clean (i.e., drop) schema prior to
* create */
drop
_s
chema
=
true
;
drop
S
chema
=
true
;
break
;
case
'd'
:
/* dump data as proper insert strings */
dumpData
=
1
;
dumpData
=
true
;
break
;
case
'D'
:
/* dump data as proper insert strings with
* attr names */
dumpData
=
1
;
attrNames
=
1
;
dumpData
=
true
;
attrNames
=
true
;
break
;
case
'f'
:
/* output file name */
filename
=
optarg
;
...
...
@@ -599,13 +599,13 @@ main(int argc, char **argv)
force_quotes
=
true
;
break
;
case
'o'
:
/* Dump oids */
oids
=
1
;
oids
=
true
;
break
;
case
'p'
:
/* server port */
pgport
=
optarg
;
break
;
case
's'
:
/* dump schema only */
schemaOnly
=
1
;
schemaOnly
=
true
;
break
;
case
't'
:
/* Dump data for this table only */
{
...
...
@@ -637,7 +637,7 @@ main(int argc, char **argv)
g_verbose
=
true
;
break
;
case
'z'
:
/* Dump ACLs and table ownership info */
aclsOption
=
1
;
aclsOption
=
true
;
break
;
case
'u'
:
use_password
=
1
;
...
...
@@ -648,6 +648,14 @@ main(int argc, char **argv)
}
}
if
(
dumpData
==
true
&&
oids
==
true
)
{
fprintf
(
stderr
,
"%s: INSERT's can not set oids, so INSERT and OID options can not be used together.
\n
"
,
progname
);
exit
(
2
);
}
/* open the output file */
if
(
filename
==
NULL
)
g_fout
=
stdout
;
...
...
@@ -714,7 +722,7 @@ main(int argc, char **argv)
g_last_builtin_oid
=
findLastBuiltinOid
();
if
(
oids
)
if
(
oids
==
true
)
setMaxOid
(
g_fout
);
if
(
!
dataOnly
)
{
...
...
@@ -1663,7 +1671,7 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
#if 0
/* XXX - how to emit this DROP TRIGGER? */
if (drop
_s
chema)
if (drop
S
chema)
{
sprintf(query, "DROP TRIGGER %s ON %s;\n",
fmtId(PQgetvalue(res2, i2, i_tgname), force_quotes),
...
...
@@ -2067,7 +2075,7 @@ dumpTypes(FILE *fout, FuncInfo *finfo, int numFuncs,
becomeUser
(
fout
,
tinfo
[
i
].
usename
);
if
(
drop
_s
chema
)
if
(
drop
S
chema
)
{
sprintf
(
q
,
"DROP TYPE %s;
\n
"
,
fmtId
(
tinfo
[
i
].
typname
,
force_quotes
));
fputs
(
q
,
fout
);
...
...
@@ -2170,7 +2178,7 @@ dumpProcLangs(FILE *fout, FuncInfo *finfo, int numFuncs,
lanname
=
checkForQuote
(
PQgetvalue
(
res
,
i
,
i_lanname
));
lancompiler
=
checkForQuote
(
PQgetvalue
(
res
,
i
,
i_lancompiler
));
if
(
drop
_s
chema
)
if
(
drop
S
chema
)
fprintf
(
fout
,
"DROP PROCEDURAL LANGUAGE '%s';
\n
"
,
lanname
);
fprintf
(
fout
,
"CREATE %sPROCEDURAL LANGUAGE '%s' "
...
...
@@ -2288,7 +2296,7 @@ dumpOneFunc(FILE *fout, FuncInfo *finfo, int i,
PQclear
(
res
);
}
if
(
drop
_s
chema
)
if
(
drop
S
chema
)
{
sprintf
(
q
,
"DROP FUNCTION %s ("
,
fmtId
(
finfo
[
i
].
proname
,
force_quotes
));
for
(
j
=
0
;
j
<
finfo
[
i
].
nargs
;
j
++
)
...
...
@@ -2415,7 +2423,7 @@ dumpOprs(FILE *fout, OprInfo *oprinfo, int numOperators,
becomeUser
(
fout
,
oprinfo
[
i
].
usename
);
if
(
drop
_s
chema
)
if
(
drop
S
chema
)
{
sprintf
(
q
,
"DROP OPERATOR %s (%s, %s);
\n
"
,
oprinfo
[
i
].
oprname
,
fmtId
(
findTypeByOid
(
tinfo
,
numTypes
,
oprinfo
[
i
].
oprleft
),
false
),
...
...
@@ -2519,7 +2527,7 @@ dumpAggs(FILE *fout, AggInfo *agginfo, int numAggs,
becomeUser
(
fout
,
agginfo
[
i
].
usename
);
if
(
drop
_s
chema
)
if
(
drop
S
chema
)
{
sprintf
(
q
,
"DROP AGGREGATE %s %s;
\n
"
,
agginfo
[
i
].
aggname
,
fmtId
(
findTypeByOid
(
tinfo
,
numTypes
,
agginfo
[
i
].
aggbasetype
),
false
));
...
...
@@ -2739,7 +2747,7 @@ dumpTables(FILE *fout, TableInfo *tblinfo, int numTables,
becomeUser
(
fout
,
tblinfo
[
i
].
usename
);
if
(
drop
_s
chema
)
if
(
drop
S
chema
)
{
sprintf
(
q
,
"DROP TABLE %s;
\n
"
,
fmtId
(
tblinfo
[
i
].
relname
,
force_quotes
));
fputs
(
q
,
fout
);
...
...
@@ -2979,7 +2987,7 @@ dumpIndices(FILE *fout, IndInfo *indinfo, int numIndices,
strcpy
(
id1
,
fmtId
(
indinfo
[
i
].
indexrelname
,
force_quotes
));
strcpy
(
id2
,
fmtId
(
indinfo
[
i
].
indrelname
,
force_quotes
));
if
(
drop
_s
chema
)
if
(
drop
S
chema
)
{
sprintf
(
q
,
"DROP INDEX %s;
\n
"
,
id1
);
fputs
(
q
,
fout
);
...
...
@@ -3245,7 +3253,7 @@ dumpSequence(FILE *fout, TableInfo tbinfo)
PQclear
(
res
);
if
(
drop
_s
chema
)
if
(
drop
S
chema
)
{
sprintf
(
query
,
"DROP SEQUENCE %s;
\n
"
,
fmtId
(
tbinfo
.
relname
,
force_quotes
));
fputs
(
query
,
fout
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录