mirror of
https://github.com/postgres/postgres.git
synced 2025-05-03 22:24:49 +03:00
In pg_upgrade, improve error reporting when the number of relation
objects does not match between the old and new clusters. Backpatch to 9.2.
This commit is contained in:
parent
087f41086b
commit
cbf99c7aa4
@ -40,14 +40,11 @@ gen_db_file_maps(DbInfo *old_db, DbInfo *new_db,
|
|||||||
int relnum;
|
int relnum;
|
||||||
int num_maps = 0;
|
int num_maps = 0;
|
||||||
|
|
||||||
if (old_db->rel_arr.nrels != new_db->rel_arr.nrels)
|
|
||||||
pg_log(PG_FATAL, "old and new databases \"%s\" have a different number of relations\n",
|
|
||||||
old_db->db_name);
|
|
||||||
|
|
||||||
maps = (FileNameMap *) pg_malloc(sizeof(FileNameMap) *
|
maps = (FileNameMap *) pg_malloc(sizeof(FileNameMap) *
|
||||||
old_db->rel_arr.nrels);
|
old_db->rel_arr.nrels);
|
||||||
|
|
||||||
for (relnum = 0; relnum < old_db->rel_arr.nrels; relnum++)
|
for (relnum = 0; relnum < Min(old_db->rel_arr.nrels, new_db->rel_arr.nrels);
|
||||||
|
relnum++)
|
||||||
{
|
{
|
||||||
RelInfo *old_rel = &old_db->rel_arr.rels[relnum];
|
RelInfo *old_rel = &old_db->rel_arr.rels[relnum];
|
||||||
RelInfo *new_rel = &new_db->rel_arr.rels[relnum];
|
RelInfo *new_rel = &new_db->rel_arr.rels[relnum];
|
||||||
@ -78,6 +75,11 @@ gen_db_file_maps(DbInfo *old_db, DbInfo *new_db,
|
|||||||
num_maps++;
|
num_maps++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Do this check after the loop so hopefully we will produce a clearer error above */
|
||||||
|
if (old_db->rel_arr.nrels != new_db->rel_arr.nrels)
|
||||||
|
pg_log(PG_FATAL, "old and new databases \"%s\" have a different number of relations\n",
|
||||||
|
old_db->db_name);
|
||||||
|
|
||||||
*nmaps = num_maps;
|
*nmaps = num_maps;
|
||||||
return maps;
|
return maps;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user