pg_dump.diff
text/x-patch
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: unified
| File | + | − |
|---|---|---|
| src/bin/pg_dump/pg_dump.c | 17 | 4 |
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 3461f3e..cc1ffd7 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -3832,6 +3832,7 @@ getTables(Archive *fout, int *numTables)
int i_reloptions;
int i_toastreloptions;
int i_reloftype;
+ bool lock_needed = false;
/* Make sure we are in proper schema */
selectSourceSchema(fout, "pg_catalog");
@@ -4273,15 +4274,21 @@ getTables(Archive *fout, int *numTables)
* NOTE: it'd be kinda nice to lock other relations too, not only
* plain tables, but the backend doesn't presently allow that.
*/
- if (tblinfo[i].dobj.dump && tblinfo[i].relkind == RELKIND_RELATION)
+ if (i == 0)
{
resetPQExpBuffer(query);
- appendPQExpBuffer(query,
- "LOCK TABLE %s IN ACCESS SHARE MODE",
+ appendPQExpBuffer(query,"LOCK TABLE ");
+ }
+
+ if (tblinfo[i].dobj.dump && tblinfo[i].relkind == RELKIND_RELATION)
+ {
+ if (lock_needed)
+ appendPQExpBuffer(query,",");
+ appendPQExpBuffer(query,"%s",
fmtQualifiedId(fout,
tblinfo[i].dobj.namespace->dobj.name,
tblinfo[i].dobj.name));
- ExecuteSqlStatement(fout, query->data);
+ lock_needed = true;
}
/* Emit notice if join for owner failed */
@@ -4290,6 +4297,12 @@ getTables(Archive *fout, int *numTables)
tblinfo[i].dobj.name);
}
+ if (lock_needed)
+ {
+ appendPQExpBuffer(query, " IN ACCESS SHARE MODE");
+ ExecuteSqlStatement(fout, query->data);
+ }
+
if (lockWaitTimeout && fout->remoteVersion >= 70300)
{
ExecuteSqlStatement(fout, "SET statement_timeout = 0");