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
4e03b827
Commit
4e03b827
authored
Jul 20, 2009
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly restore pg_largeobject.relfozenxid in binary upgrade mode.
Backpatch to 8.4.X.
parent
396a493c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
1 deletion
+48
-1
src/bin/pg_dump/pg_dump.c
src/bin/pg_dump/pg_dump.c
+48
-1
No files found.
src/bin/pg_dump/pg_dump.c
View file @
4e03b827
...
...
@@ -12,7 +12,7 @@
* by PostgreSQL
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.54
0 2009/07/02 21:34:32 tgl
Exp $
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.54
1 2009/07/20 20:53:40 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -34,6 +34,7 @@
#include "access/sysattr.h"
#include "catalog/pg_cast.h"
#include "catalog/pg_class.h"
#include "catalog/pg_largeobject.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_trigger.h"
#include "catalog/pg_type.h"
...
...
@@ -1739,6 +1740,7 @@ dumpDatabase(Archive *AH)
frozenxid
);
appendStringLiteralAH
(
creaQry
,
datname
,
AH
);
appendPQExpBuffer
(
creaQry
,
";
\n
"
);
}
appendPQExpBuffer
(
delQry
,
"DROP DATABASE %s;
\n
"
,
...
...
@@ -1764,6 +1766,51 @@ dumpDatabase(Archive *AH)
NULL
,
/* Dumper */
NULL
);
/* Dumper Arg */
/*
* pg_largeobject comes from the old system intact, so set
* its relfrozenxid.
*/
if
(
binary_upgrade
)
{
PGresult
*
lo_res
;
PQExpBuffer
loFrozenQry
=
createPQExpBuffer
();
PQExpBuffer
loOutQry
=
createPQExpBuffer
();
int
i_relfrozenxid
;
appendPQExpBuffer
(
loFrozenQry
,
"SELECT relfrozenxid
\n
"
"FROM pg_catalog.pg_class
\n
"
"WHERE oid = %d;
\n
"
,
LargeObjectRelationId
);
lo_res
=
PQexec
(
g_conn
,
loFrozenQry
->
data
);
check_sql_result
(
lo_res
,
g_conn
,
loFrozenQry
->
data
,
PGRES_TUPLES_OK
);
if
(
PQntuples
(
lo_res
)
!=
1
)
{
write_msg
(
NULL
,
"dumpDatabase(): could not find pg_largeobject.relfrozenxid
\n
"
);
exit_nicely
();
}
i_relfrozenxid
=
PQfnumber
(
lo_res
,
"relfrozenxid"
);
appendPQExpBuffer
(
loOutQry
,
"
\n
-- For binary upgrade, set pg_largeobject relfrozenxid.
\n
"
);
appendPQExpBuffer
(
loOutQry
,
"UPDATE pg_catalog.pg_class
\n
"
"SET relfrozenxid = '%u'
\n
"
"WHERE oid = %d;
\n
"
,
atoi
(
PQgetvalue
(
lo_res
,
0
,
i_relfrozenxid
)),
LargeObjectRelationId
);
ArchiveEntry
(
AH
,
nilCatalogId
,
createDumpId
(),
"pg_largeobject"
,
NULL
,
NULL
,
""
,
false
,
"pg_largeobject"
,
SECTION_PRE_DATA
,
loOutQry
->
data
,
""
,
NULL
,
NULL
,
0
,
NULL
,
NULL
);
PQclear
(
lo_res
);
destroyPQExpBuffer
(
loFrozenQry
);
destroyPQExpBuffer
(
loOutQry
);
}
/* Dump DB comment if any */
if
(
g_fout
->
remoteVersion
>=
80200
)
{
...
...
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