Skip to content

Commit fe8f15d

Browse files
committed
Adjust pg_upgrade error message, array freeing, and add error check.
1 parent f5fc1de commit fe8f15d

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

contrib/pg_upgrade/check.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,6 @@ check_new_db_is_empty(void)
362362
}
363363
}
364364

365-
free_db_and_rel_infos(&new_cluster.dbarr);
366-
367365
if (found)
368366
pg_log(PG_FATAL, "New cluster is not empty; exiting\n");
369367
}

contrib/pg_upgrade/info.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,12 @@ create_rel_filename_map(const char *old_data, const char *new_data,
104104
/* new_relfilenode will match old and new pg_class.oid */
105105
map->new_relfilenode = new_rel->relfilenode;
106106

107+
if (strcmp(old_rel->nspname, new_rel->nspname) != 0 ||
108+
strcmp(old_rel->relname, new_rel->relname) != 0)
109+
pg_log(PG_FATAL, "mismatch of relation id: database \"%s\", old rel %s.%s, new rel %s.%s\n",
110+
old_db, old_rel->nspname, old_rel->relname,
111+
new_rel->nspname, new_rel->relname);
112+
107113
/* used only for logging and error reporing, old/new are identical */
108114
snprintf(map->nspname, sizeof(map->nspname), "%s", old_rel->nspname);
109115
snprintf(map->relname, sizeof(map->relname), "%s", old_rel->relname);
@@ -141,6 +147,9 @@ get_db_and_rel_infos(ClusterInfo *cluster)
141147
{
142148
int dbnum;
143149

150+
if (cluster->dbarr)
151+
free_db_and_rel_infos(cluster->dbarr);
152+
144153
get_db_infos(cluster);
145154

146155
for (dbnum = 0; dbnum < cluster->dbarr.ndbs; dbnum++)

contrib/pg_upgrade/pg_upgrade.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,6 @@ create_new_objects(void)
286286
check_ok();
287287

288288
/* regenerate now that we have objects in the databases */
289-
free_db_and_rel_infos(&new_cluster.dbarr);
290289
get_db_and_rel_infos(&new_cluster);
291290

292291
uninstall_support_functions_from_new_cluster();

contrib/pg_upgrade/relfilenode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ transfer_all_new_dbs(DbInfoArr *old_db_arr,
4949
pageCnvCtx *pageConverter = NULL;
5050

5151
if (strcmp(old_db->db_name, new_db->db_name) != 0)
52-
pg_log(PG_FATAL, "old and new databases have a different names: old \"%s\", new \"%s\"\n",
52+
pg_log(PG_FATAL, "old and new databases have different names: old \"%s\", new \"%s\"\n",
5353
old_db->db_name, new_db->db_name);
5454

5555
n_maps = 0;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy