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

Commitf6ef3ed

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 parent506bbbf commitf6ef3ed

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

‎src/bin/pg_dump/pg_dump.c

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7132,8 +7132,8 @@ getConstraints(Archive *fout, TableInfo tblinfo[], int numTables)
71327132
TableInfo *tbinfo = &tblinfo[i];
71337133

71347134
/*
7135-
* For partitioned tables, foreign keys have no triggers so they
7136-
*mustbe included anyway in case some foreign keys are defined.
7135+
* For partitioned tables, foreign keys have no triggers so they must
7136+
* be included anyway in case some foreign keys are defined.
71377137
*/
71387138
if ((!tbinfo->hastriggers &&
71397139
tbinfo->relkind != RELKIND_PARTITIONED_TABLE) ||
@@ -16211,6 +16211,12 @@ dumpIndex(Archive *fout, IndxInfo *indxinfo)
1621116211
/* Plain secondary index */
1621216212
appendPQExpBuffer(q, "%s;\n", indxinfo->indexdef);
1621316213

16214+
/*
16215+
* Append ALTER TABLE commands as needed to set properties that we
16216+
* only have ALTER TABLE syntax for. Keep this in sync with the
16217+
* similar code in dumpConstraint!
16218+
*/
16219+
1621416220
/* If the index is clustered, we need to record that. */
1621516221
if (indxinfo->indisclustered)
1621616222
{
@@ -16460,6 +16466,12 @@ dumpConstraint(Archive *fout, ConstraintInfo *coninfo)
1646016466
appendPQExpBufferStr(q, ";\n");
1646116467
}
1646216468

16469+
/*
16470+
* Append ALTER TABLE commands as needed to set properties that we
16471+
* only have ALTER TABLE syntax for. Keep this in sync with the
16472+
* similar code in dumpIndex!
16473+
*/
16474+
1646316475
/* If the index is clustered, we need to record that. */
1646416476
if (indxinfo->indisclustered)
1646516477
{
@@ -16470,6 +16482,16 @@ dumpConstraint(Archive *fout, ConstraintInfo *coninfo)
1647016482
fmtId(indxinfo->dobj.name));
1647116483
}
1647216484

16485+
/* If the index defines identity, we need to record that. */
16486+
if (indxinfo->indisreplident)
16487+
{
16488+
appendPQExpBuffer(q, "\nALTER TABLE ONLY %s REPLICA IDENTITY USING",
16489+
fmtQualifiedDumpable(tbinfo));
16490+
/* index name is not qualified in this syntax */
16491+
appendPQExpBuffer(q, " INDEX %s;\n",
16492+
fmtId(indxinfo->dobj.name));
16493+
}
16494+
1647316495
appendPQExpBuffer(delq, "ALTER TABLE ONLY %s ",
1647416496
fmtQualifiedDumpable(tbinfo));
1647516497
appendPQExpBuffer(delq, "DROP CONSTRAINT %s;\n",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp