1
0
mirror of https://github.com/postgres/postgres.git synced 2025-05-29 16:21:20 +03:00

Remove is_index parameter from binary_upgrade_set_pg_class_oids().

Since commit 9a974cbcba, 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
This commit is contained in:
Nathan Bossart 2024-07-03 10:58:26 -05:00
parent f3412a61f3
commit 6e1c4a03a9

View File

@ -324,7 +324,7 @@ static void binary_upgrade_set_type_oids_by_rel(Archive *fout,
const TableInfo *tbinfo); const TableInfo *tbinfo);
static void binary_upgrade_set_pg_class_oids(Archive *fout, static void binary_upgrade_set_pg_class_oids(Archive *fout,
PQExpBuffer upgrade_buffer, PQExpBuffer upgrade_buffer,
Oid pg_class_oid, bool is_index); Oid pg_class_oid);
static void binary_upgrade_extension_member(PQExpBuffer upgrade_buffer, static void binary_upgrade_extension_member(PQExpBuffer upgrade_buffer,
const DumpableObject *dobj, const DumpableObject *dobj,
const char *objtype, const char *objtype,
@ -5385,8 +5385,7 @@ binary_upgrade_set_type_oids_by_rel(Archive *fout,
static void static void
binary_upgrade_set_pg_class_oids(Archive *fout, binary_upgrade_set_pg_class_oids(Archive *fout,
PQExpBuffer upgrade_buffer, Oid pg_class_oid, PQExpBuffer upgrade_buffer, Oid pg_class_oid)
bool is_index)
{ {
PQExpBuffer upgrade_query = createPQExpBuffer(); PQExpBuffer upgrade_query = createPQExpBuffer();
PGresult *upgrade_res; PGresult *upgrade_res;
@ -5435,7 +5434,8 @@ binary_upgrade_set_pg_class_oids(Archive *fout,
appendPQExpBufferStr(upgrade_buffer, appendPQExpBufferStr(upgrade_buffer,
"\n-- For binary upgrade, must preserve pg_class oids and relfilenodes\n"); "\n-- For binary upgrade, must preserve pg_class oids and relfilenodes\n");
if (!is_index) if (relkind != RELKIND_INDEX &&
relkind != RELKIND_PARTITIONED_INDEX)
{ {
appendPQExpBuffer(upgrade_buffer, appendPQExpBuffer(upgrade_buffer,
"SELECT pg_catalog.binary_upgrade_set_next_heap_pg_class_oid('%u'::pg_catalog.oid);\n", "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)
binary_upgrade_set_type_oids_by_type_oid(fout, q, binary_upgrade_set_type_oids_by_type_oid(fout, q,
tyinfo->dobj.catId.oid, tyinfo->dobj.catId.oid,
false, false); false, false);
binary_upgrade_set_pg_class_oids(fout, q, tyinfo->typrelid, false); binary_upgrade_set_pg_class_oids(fout, q, tyinfo->typrelid);
} }
qtypname = pg_strdup(fmtId(tyinfo->dobj.name)); qtypname = pg_strdup(fmtId(tyinfo->dobj.name));
@ -15654,7 +15654,7 @@ dumpTableSchema(Archive *fout, const TableInfo *tbinfo)
if (dopt->binary_upgrade) if (dopt->binary_upgrade)
binary_upgrade_set_pg_class_oids(fout, q, binary_upgrade_set_pg_class_oids(fout, q,
tbinfo->dobj.catId.oid, false); tbinfo->dobj.catId.oid);
appendPQExpBuffer(q, "CREATE VIEW %s", qualrelname); appendPQExpBuffer(q, "CREATE VIEW %s", qualrelname);
@ -15756,7 +15756,7 @@ dumpTableSchema(Archive *fout, const TableInfo *tbinfo)
if (dopt->binary_upgrade) if (dopt->binary_upgrade)
binary_upgrade_set_pg_class_oids(fout, q, binary_upgrade_set_pg_class_oids(fout, q,
tbinfo->dobj.catId.oid, false); tbinfo->dobj.catId.oid);
appendPQExpBuffer(q, "CREATE %s%s %s", appendPQExpBuffer(q, "CREATE %s%s %s",
tbinfo->relpersistence == RELPERSISTENCE_UNLOGGED ? tbinfo->relpersistence == RELPERSISTENCE_UNLOGGED ?
@ -16607,7 +16607,7 @@ dumpIndex(Archive *fout, const IndxInfo *indxinfo)
if (dopt->binary_upgrade) if (dopt->binary_upgrade)
binary_upgrade_set_pg_class_oids(fout, q, binary_upgrade_set_pg_class_oids(fout, q,
indxinfo->dobj.catId.oid, true); indxinfo->dobj.catId.oid);
/* Plain secondary index */ /* Plain secondary index */
appendPQExpBuffer(q, "%s;\n", indxinfo->indexdef); appendPQExpBuffer(q, "%s;\n", indxinfo->indexdef);
@ -16861,7 +16861,7 @@ dumpConstraint(Archive *fout, const ConstraintInfo *coninfo)
if (dopt->binary_upgrade) if (dopt->binary_upgrade)
binary_upgrade_set_pg_class_oids(fout, q, binary_upgrade_set_pg_class_oids(fout, q,
indxinfo->dobj.catId.oid, true); indxinfo->dobj.catId.oid);
appendPQExpBuffer(q, "ALTER %sTABLE ONLY %s\n", foreign, appendPQExpBuffer(q, "ALTER %sTABLE ONLY %s\n", foreign,
fmtQualifiedDumpable(tbinfo)); fmtQualifiedDumpable(tbinfo));
@ -17255,7 +17255,7 @@ dumpSequence(Archive *fout, const TableInfo *tbinfo)
if (dopt->binary_upgrade) if (dopt->binary_upgrade)
{ {
binary_upgrade_set_pg_class_oids(fout, query, binary_upgrade_set_pg_class_oids(fout, query,
tbinfo->dobj.catId.oid, false); tbinfo->dobj.catId.oid);
/* /*
* In older PG versions a sequence will have a pg_type entry, but v14 * In older PG versions a sequence will have a pg_type entry, but v14