Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
cda776e6
Commit
cda776e6
authored
Oct 16, 2002
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make pg_dump save for autocommit = off.
parent
ec64390e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
15 deletions
+32
-15
src/bin/pg_dump/pg_backup_archiver.c
src/bin/pg_dump/pg_backup_archiver.c
+2
-6
src/bin/pg_dump/pg_backup_db.c
src/bin/pg_dump/pg_backup_db.c
+25
-3
src/bin/pg_dump/pg_dump.c
src/bin/pg_dump/pg_dump.c
+5
-6
No files found.
src/bin/pg_dump/pg_backup_archiver.c
View file @
cda776e6
...
...
@@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.5
7 2002/09/04 20:31:3
4 momjian Exp $
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.5
8 2002/10/16 05:46:5
4 momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -280,7 +280,7 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
/*
* If we can output the data, then restore it.
*/
if
(
AH
->
PrintTocDataPtr
!=
NULL
&&
(
reqs
&
REQ_DATA
)
!=
0
)
if
(
AH
->
PrintTocDataPtr
!=
NULL
&&
(
reqs
&
REQ_DATA
)
!=
0
)
{
#ifndef HAVE_LIBZ
if
(
AH
->
compression
!=
0
)
...
...
@@ -304,11 +304,9 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
*/
if
(
!
AH
->
CustomOutPtr
)
write_msg
(
modulename
,
"WARNING: skipping large object restoration
\n
"
);
}
else
{
_disableTriggersIfNecessary
(
AH
,
te
,
ropt
);
/*
...
...
@@ -362,11 +360,9 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
te
=
AH
->
toc
->
next
;
while
(
te
!=
AH
->
toc
)
{
/* Is it table data? */
if
(
strcmp
(
te
->
desc
,
"TABLE DATA"
)
==
0
)
{
ahlog
(
AH
,
2
,
"checking whether we loaded %s
\n
"
,
te
->
tag
);
reqs
=
_tocEntryRequired
(
te
,
ropt
);
...
...
src/bin/pg_dump/pg_backup_db.c
View file @
cda776e6
...
...
@@ -5,7 +5,7 @@
* Implements the basic DB functions used by the archiver.
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.4
1 2002/09/07 16:14:33 petere
Exp $
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.4
2 2002/10/16 05:46:54 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -61,11 +61,15 @@ _check_database_version(ArchiveHandle *AH, bool ignoreVersion)
myversion
=
_parse_version
(
AH
,
PG_VERSION
);
res
=
PQexec
(
conn
,
"SELECT version();"
);
/*
* Autocommit could be off. We turn it off later but we have to check
* the database version first.
*/
res
=
PQexec
(
conn
,
"BEGIN;SELECT version();"
);
if
(
!
res
||
PQresultStatus
(
res
)
!=
PGRES_TUPLES_OK
||
PQntuples
(
res
)
!=
1
)
die_horribly
(
AH
,
modulename
,
"could not get version from server: %s"
,
PQerrorMessage
(
conn
));
remoteversion_str
=
PQgetvalue
(
res
,
0
,
0
);
...
...
@@ -73,6 +77,12 @@ _check_database_version(ArchiveHandle *AH, bool ignoreVersion)
PQclear
(
res
);
res
=
PQexec
(
conn
,
"COMMIT;"
);
if
(
!
res
||
PQresultStatus
(
res
)
!=
PGRES_COMMAND_OK
)
die_horribly
(
AH
,
modulename
,
"could not get version from server: %s"
,
PQerrorMessage
(
conn
));
PQclear
(
res
);
AH
->
public
.
remoteVersion
=
remoteversion
;
if
(
myversion
!=
remoteversion
...
...
@@ -277,6 +287,18 @@ ConnectDatabase(Archive *AHX,
/* check for version mismatch */
_check_database_version
(
AH
,
ignoreVersion
);
/* Turn autocommit on */
if
(
AH
->
public
.
remoteVersion
>=
70300
)
{
PGresult
*
res
;
res
=
PQexec
(
AH
->
connection
,
"SET autocommit TO 'on'"
);
if
(
!
res
||
PQresultStatus
(
res
)
!=
PGRES_COMMAND_OK
)
die_horribly
(
AH
,
NULL
,
"SET autocommit TO 'on' failed: %s"
,
PQerrorMessage
(
AH
->
connection
));
PQclear
(
res
);
}
PQsetNoticeProcessor
(
AH
->
connection
,
notice_processor
,
NULL
);
return
AH
->
connection
;
...
...
src/bin/pg_dump/pg_dump.c
View file @
cda776e6
...
...
@@ -22,7 +22,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.30
2 2002/10/09 16:20:25
momjian Exp $
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.30
3 2002/10/16 05:46:54
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -549,22 +549,21 @@ main(int argc, char **argv)
g_conn
=
ConnectDatabase
(
g_fout
,
dbname
,
pghost
,
pgport
,
username
,
force_password
,
ignore_version
);
/*
* Start serializable transaction to dump consistent data
* Start serializable transaction to dump consistent data
.
*/
{
PGresult
*
res
;
res
=
PQexec
(
g_conn
,
"
begin
"
);
res
=
PQexec
(
g_conn
,
"
BEGIN
"
);
if
(
!
res
||
PQresultStatus
(
res
)
!=
PGRES_COMMAND_OK
)
exit_horribly
(
g_fout
,
NULL
,
"BEGIN command failed: %s"
,
PQerrorMessage
(
g_conn
));
PQclear
(
res
);
res
=
PQexec
(
g_conn
,
"set transaction isolation level serializable"
);
res
=
PQexec
(
g_conn
,
"SET TRANSACTION ISOLATION LEVEL SERIALIZABLE"
);
if
(
!
res
||
PQresultStatus
(
res
)
!=
PGRES_COMMAND_OK
)
exit_horribly
(
g_fout
,
NULL
,
"could not set transaction isolation level to serializable: %s"
,
PQerrorMessage
(
g_conn
));
PQclear
(
res
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment