Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2560d24

Browse files
committed
Fix quoting and a compiler warning in dumping partitions.
Partition name needs to be quoted in the ATTACH PARTITION commandconstructed in binary-upgrade mode.Silence compiler warning about set but unused variable, without--enable-cassert.
1 parentfe7bdf0 commit2560d24

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

‎src/bin/pg_dump/pg_dump.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7022,8 +7022,7 @@ void
70227022
getTablePartitionKeyInfo(Archive *fout, TableInfo *tblinfo, int numTables)
70237023
{
70247024
PQExpBuffer q = createPQExpBuffer();
7025-
inti,
7026-
ntups;
7025+
inti;
70277026
PGresult *res;
70287027

70297028
/* No partitioned tables before 10 */
@@ -7046,8 +7045,7 @@ getTablePartitionKeyInfo(Archive *fout, TableInfo *tblinfo, int numTables)
70467045
appendPQExpBuffer(q, "SELECT pg_catalog.pg_get_partkeydef('%u'::pg_catalog.oid)",
70477046
tbinfo->dobj.catId.oid);
70487047
res = ExecuteSqlQuery(fout, q->data, PGRES_TUPLES_OK);
7049-
ntups = PQntuples(res);
7050-
Assert(ntups == 1);
7048+
Assert(PQntuples(res) == 1);
70517049
tbinfo->partkeydef = pg_strdup(PQgetvalue(res, 0, 0));
70527050
}
70537051
}
@@ -14639,9 +14637,10 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo)
1463914637
if (tbinfo->partitionOf)
1464014638
{
1464114639
appendPQExpBufferStr(q, "\n-- For binary upgrade, set up partitions this way.\n");
14642-
appendPQExpBuffer(q, "ALTER TABLE ONLY %s ATTACH PARTITION %s %s;\n",
14643-
fmtId(tbinfo->partitionOf->dobj.name),
14644-
tbinfo->dobj.name,
14640+
appendPQExpBuffer(q, "ALTER TABLE ONLY %s ",
14641+
fmtId(tbinfo->partitionOf->dobj.name));
14642+
appendPQExpBuffer(q, "ATTACH PARTITION %s %s;\n",
14643+
fmtId(tbinfo->dobj.name),
1464514644
tbinfo->partitiondef);
1464614645
}
1464714646

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp