Skip to content

Commit 6e1c4a0

Browse files
Remove is_index parameter from binary_upgrade_set_pg_class_oids().
Since commit 9a974cb, this function retrieves the relkind before it needs to know whether the relation is an index, so we no longer need callers to provide this information. Suggested-by: Daniel Gustafsson Reviewed-by: Daniel Gustafsson Discussion: https://postgr.es/m/20240418041712.GA3441570%40nathanxps13
1 parent f3412a6 commit 6e1c4a0

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/bin/pg_dump/pg_dump.c

+10-10
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ static void binary_upgrade_set_type_oids_by_rel(Archive *fout,
324324
const TableInfo *tbinfo);
325325
static void binary_upgrade_set_pg_class_oids(Archive *fout,
326326
PQExpBuffer upgrade_buffer,
327-
Oid pg_class_oid, bool is_index);
327+
Oid pg_class_oid);
328328
static void binary_upgrade_extension_member(PQExpBuffer upgrade_buffer,
329329
const DumpableObject *dobj,
330330
const char *objtype,
@@ -5385,8 +5385,7 @@ binary_upgrade_set_type_oids_by_rel(Archive *fout,
53855385

53865386
static void
53875387
binary_upgrade_set_pg_class_oids(Archive *fout,
5388-
PQExpBuffer upgrade_buffer, Oid pg_class_oid,
5389-
bool is_index)
5388+
PQExpBuffer upgrade_buffer, Oid pg_class_oid)
53905389
{
53915390
PQExpBuffer upgrade_query = createPQExpBuffer();
53925391
PGresult *upgrade_res;
@@ -5435,7 +5434,8 @@ binary_upgrade_set_pg_class_oids(Archive *fout,
54355434
appendPQExpBufferStr(upgrade_buffer,
54365435
"\n-- For binary upgrade, must preserve pg_class oids and relfilenodes\n");
54375436

5438-
if (!is_index)
5437+
if (relkind != RELKIND_INDEX &&
5438+
relkind != RELKIND_PARTITIONED_INDEX)
54395439
{
54405440
appendPQExpBuffer(upgrade_buffer,
54415441
"SELECT pg_catalog.binary_upgrade_set_next_heap_pg_class_oid('%u'::pg_catalog.oid);\n",
@@ -11520,7 +11520,7 @@ dumpCompositeType(Archive *fout, const TypeInfo *tyinfo)
1152011520
binary_upgrade_set_type_oids_by_type_oid(fout, q,
1152111521
tyinfo->dobj.catId.oid,
1152211522
false, false);
11523-
binary_upgrade_set_pg_class_oids(fout, q, tyinfo->typrelid, false);
11523+
binary_upgrade_set_pg_class_oids(fout, q, tyinfo->typrelid);
1152411524
}
1152511525

1152611526
qtypname = pg_strdup(fmtId(tyinfo->dobj.name));
@@ -15654,7 +15654,7 @@ dumpTableSchema(Archive *fout, const TableInfo *tbinfo)
1565415654

1565515655
if (dopt->binary_upgrade)
1565615656
binary_upgrade_set_pg_class_oids(fout, q,
15657-
tbinfo->dobj.catId.oid, false);
15657+
tbinfo->dobj.catId.oid);
1565815658

1565915659
appendPQExpBuffer(q, "CREATE VIEW %s", qualrelname);
1566015660

@@ -15756,7 +15756,7 @@ dumpTableSchema(Archive *fout, const TableInfo *tbinfo)
1575615756

1575715757
if (dopt->binary_upgrade)
1575815758
binary_upgrade_set_pg_class_oids(fout, q,
15759-
tbinfo->dobj.catId.oid, false);
15759+
tbinfo->dobj.catId.oid);
1576015760

1576115761
appendPQExpBuffer(q, "CREATE %s%s %s",
1576215762
tbinfo->relpersistence == RELPERSISTENCE_UNLOGGED ?
@@ -16607,7 +16607,7 @@ dumpIndex(Archive *fout, const IndxInfo *indxinfo)
1660716607

1660816608
if (dopt->binary_upgrade)
1660916609
binary_upgrade_set_pg_class_oids(fout, q,
16610-
indxinfo->dobj.catId.oid, true);
16610+
indxinfo->dobj.catId.oid);
1661116611

1661216612
/* Plain secondary index */
1661316613
appendPQExpBuffer(q, "%s;\n", indxinfo->indexdef);
@@ -16861,7 +16861,7 @@ dumpConstraint(Archive *fout, const ConstraintInfo *coninfo)
1686116861

1686216862
if (dopt->binary_upgrade)
1686316863
binary_upgrade_set_pg_class_oids(fout, q,
16864-
indxinfo->dobj.catId.oid, true);
16864+
indxinfo->dobj.catId.oid);
1686516865

1686616866
appendPQExpBuffer(q, "ALTER %sTABLE ONLY %s\n", foreign,
1686716867
fmtQualifiedDumpable(tbinfo));
@@ -17255,7 +17255,7 @@ dumpSequence(Archive *fout, const TableInfo *tbinfo)
1725517255
if (dopt->binary_upgrade)
1725617256
{
1725717257
binary_upgrade_set_pg_class_oids(fout, query,
17258-
tbinfo->dobj.catId.oid, false);
17258+
tbinfo->dobj.catId.oid);
1725917259

1726017260
/*
1726117261
* In older PG versions a sequence will have a pg_type entry, but v14

0 commit comments

Comments
 (0)