Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
9b35ec26
Commit
9b35ec26
authored
25 years ago
by
Bruce Momjian
Browse files
Options
Downloads
Patches
Plain Diff
Disable use of -o and -d pg_dump options together. Can't set oids in
inserts. Change some variables to bool to be clearer.
parent
9c56b408
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/bin/pg_dump/pg_dump.c
+38
-30
38 additions, 30 deletions
src/bin/pg_dump/pg_dump.c
with
38 additions
and
30 deletions
src/bin/pg_dump/pg_dump.c
+
38
−
30
View file @
9b35ec26
...
...
@@ -21,7 +21,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.10
9
1999/05/26 1
4:50:38
momjian Exp $
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.1
1
0 1999/05/26 1
6: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
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment