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

Commit96b1d98

Browse files
committed
Fix pg_dump's failure to dump REPLICA IDENTITY for constraint indexes.
pg_dump knew about printing ALTER TABLE ... REPLICA IDENTITY USING INDEXfor indexes declared as indexes, but it failed to print that for indexesdeclared as unique or primary-key constraints. Per report from AchilleasMantzios.This has been broken since the feature was introduced, AFAICS.Back-patch to 9.4.Discussion:https://postgr.es/m/1e6cc5ad-b84a-7c07-8c08-a4d0c3cdc938@matrix.gatewaynet.com
1 parent406df42 commit96b1d98

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

‎src/bin/pg_dump/pg_dump.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15633,6 +15633,12 @@ dumpIndex(Archive *fout, IndxInfo *indxinfo)
1563315633
/* Plain secondary index */
1563415634
appendPQExpBuffer(q, "%s;\n", indxinfo->indexdef);
1563515635

15636+
/*
15637+
* Append ALTER TABLE commands as needed to set properties that we
15638+
* only have ALTER TABLE syntax for. Keep this in sync with the
15639+
* similar code in dumpConstraint!
15640+
*/
15641+
1563615642
/* If the index is clustered, we need to record that. */
1563715643
if (indxinfo->indisclustered)
1563815644
{
@@ -15833,6 +15839,12 @@ dumpConstraint(Archive *fout, ConstraintInfo *coninfo)
1583315839
appendPQExpBufferStr(q, ";\n");
1583415840
}
1583515841

15842+
/*
15843+
* Append ALTER TABLE commands as needed to set properties that we
15844+
* only have ALTER TABLE syntax for. Keep this in sync with the
15845+
* similar code in dumpIndex!
15846+
*/
15847+
1583615848
/* If the index is clustered, we need to record that. */
1583715849
if (indxinfo->indisclustered)
1583815850
{
@@ -15843,6 +15855,16 @@ dumpConstraint(Archive *fout, ConstraintInfo *coninfo)
1584315855
fmtId(indxinfo->dobj.name));
1584415856
}
1584515857

15858+
/* If the index defines identity, we need to record that. */
15859+
if (indxinfo->indisreplident)
15860+
{
15861+
appendPQExpBuffer(q, "\nALTER TABLE ONLY %s REPLICA IDENTITY USING",
15862+
fmtQualifiedDumpable(tbinfo));
15863+
/* index name is not qualified in this syntax */
15864+
appendPQExpBuffer(q, " INDEX %s;\n",
15865+
fmtId(indxinfo->dobj.name));
15866+
}
15867+
1584615868
appendPQExpBuffer(delq, "ALTER TABLE ONLY %s ",
1584715869
fmtQualifiedDumpable(tbinfo));
1584815870
appendPQExpBuffer(delq, "DROP CONSTRAINT %s;\n",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp