git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fe7bdf0)
Fix quoting and a compiler warning in dumping partitions.
Thu, 8 Dec 2016 12:10:10 +0000 (14:10 +0200)
Thu, 8 Dec 2016 12:10:10 +0000 (14:10 +0200)
Partition name needs to be quoted in the ATTACH PARTITION command
constructed in binary-upgrade mode.

Silence compiler warning about set but unused variable, without
--enable-cassert.


diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index b43d152e77e580f6bee0cf380a31fcba34f54ed8..7949aad3670a8d2a818a06a12a1e284f732b28b4 100644 (file)
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -7022,8 +7022,7 @@ void
getTablePartitionKeyInfo(Archive *fout, TableInfo *tblinfo, int numTables)
{
PQExpBuffer q = createPQExpBuffer();
- int i,
- ntups;
+ int i;
PGresult *res;
/* No partitioned tables before 10 */
@@ -7046,8 +7045,7 @@ getTablePartitionKeyInfo(Archive *fout, TableInfo *tblinfo, int numTables)
appendPQExpBuffer(q, "SELECT pg_catalog.pg_get_partkeydef('%u'::pg_catalog.oid)",
tbinfo->dobj.catId.oid);
res = ExecuteSqlQuery(fout, q->data, PGRES_TUPLES_OK);
- ntups = PQntuples(res);
- Assert(ntups == 1);
+ Assert(PQntuples(res) == 1);
tbinfo->partkeydef = pg_strdup(PQgetvalue(res, 0, 0));
}
}
@@ -14639,9 +14637,10 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo)
if (tbinfo->partitionOf)
{
appendPQExpBufferStr(q, "\n-- For binary upgrade, set up partitions this way.\n");
- appendPQExpBuffer(q, "ALTER TABLE ONLY %s ATTACH PARTITION %s %s;\n",
- fmtId(tbinfo->partitionOf->dobj.name),
- tbinfo->dobj.name,
+ appendPQExpBuffer(q, "ALTER TABLE ONLY %s ",
+ fmtId(tbinfo->partitionOf->dobj.name));
+ appendPQExpBuffer(q, "ATTACH PARTITION %s %s;\n",
+ fmtId(tbinfo->dobj.name),
tbinfo->partitiondef);
}
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /