Skip to content

Commit 1cc19cc

Browse files
committed
Fix bug in 9.1 pg_upgrade processing of old/new relations; adjust debug
output.
1 parent 89c29c0 commit 1cc19cc

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

contrib/pg_upgrade/info.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ gen_db_file_maps(DbInfo *old_db, DbInfo *new_db,
4848
for (relnum = 0; relnum < old_db->rel_arr.nrels; relnum++)
4949
{
5050
RelInfo *old_rel = &old_db->rel_arr.rels[relnum];
51-
RelInfo *new_rel = &old_db->rel_arr.rels[relnum];
51+
RelInfo *new_rel = &new_db->rel_arr.rels[relnum];
5252

5353
if (old_rel->reloid != new_rel->reloid)
5454
pg_log(PG_FATAL, "mismatch of relation id: database \"%s\", old relid %d, new relid %d\n",
@@ -147,7 +147,8 @@ get_db_and_rel_infos(ClusterInfo *cluster)
147147
{
148148
int dbnum;
149149

150-
free_db_and_rel_infos(&cluster->dbarr);
150+
if (cluster->dbarr.dbs != NULL)
151+
free_db_and_rel_infos(&cluster->dbarr);
151152

152153
get_db_infos(cluster);
153154

@@ -156,7 +157,7 @@ get_db_and_rel_infos(ClusterInfo *cluster)
156157

157158
if (log_opts.debug)
158159
{
159-
pg_log(PG_DEBUG, "%s databases\n", CLUSTER_NAME(cluster));
160+
pg_log(PG_DEBUG, "\n%s databases:\n", CLUSTER_NAME(cluster));
160161
print_db_infos(&cluster->dbarr);
161162
}
162163
}
@@ -319,6 +320,7 @@ free_db_and_rel_infos(DbInfoArr *db_arr)
319320
for (dbnum = 0; dbnum < db_arr->ndbs; dbnum++)
320321
free_rel_infos(&db_arr->dbs[dbnum].rel_arr);
321322
pg_free(db_arr->dbs);
323+
db_arr->dbs = NULL;
322324
db_arr->ndbs = 0;
323325
}
324326

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