mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-09 08:10:09 +08:00
Restructure pg_upgrade checks because pre-8.4 Postgres did not rename
toast file names to match the new relfilenode.
This commit is contained in:
parent
f7b70dfc76
commit
9e5bed2df1
@ -51,9 +51,18 @@ gen_db_file_maps(DbInfo *old_db, DbInfo *new_db,
|
||||
RelInfo *new_rel = &new_db->rel_arr.rels[relnum];
|
||||
|
||||
if (old_rel->reloid != new_rel->reloid)
|
||||
pg_log(PG_FATAL, "mismatch of relation id: database \"%s\", old relid %d, new relid %d\n",
|
||||
pg_log(PG_FATAL, "Mismatch of relation id: database \"%s\", old relid %d, new relid %d\n",
|
||||
old_db->db_name, old_rel->reloid, new_rel->reloid);
|
||||
|
||||
|
||||
/* toast names were not renamed to match their relfilenodes in pre-8.4 */
|
||||
if (GET_MAJOR_VERSION(old_cluster.major_version) >= 804 &&
|
||||
(strcmp(old_rel->nspname, new_rel->nspname) != 0 ||
|
||||
strcmp(old_rel->relname, new_rel->relname) != 0))
|
||||
pg_log(PG_FATAL, "Mismatch of relation names: database \"%s\", "
|
||||
"old rel %s.%s, new rel %s.%s\n",
|
||||
old_db->db_name, old_rel->nspname, old_rel->relname,
|
||||
new_rel->nspname, new_rel->relname);
|
||||
|
||||
create_rel_filename_map(old_pgdata, new_pgdata, old_db, new_db,
|
||||
old_rel, new_rel, maps + num_maps);
|
||||
num_maps++;
|
||||
@ -104,12 +113,6 @@ create_rel_filename_map(const char *old_data, const char *new_data,
|
||||
/* new_relfilenode will match old and new pg_class.oid */
|
||||
map->new_relfilenode = new_rel->relfilenode;
|
||||
|
||||
if (strcmp(old_rel->nspname, new_rel->nspname) != 0 ||
|
||||
strcmp(old_rel->relname, new_rel->relname) != 0)
|
||||
pg_log(PG_FATAL, "mismatch of relation id: database \"%s\", old rel %s.%s, new rel %s.%s\n",
|
||||
old_db->db_name, old_rel->nspname, old_rel->relname,
|
||||
new_rel->nspname, new_rel->relname);
|
||||
|
||||
/* used only for logging and error reporing, old/new are identical */
|
||||
snprintf(map->nspname, sizeof(map->nspname), "%s", old_rel->nspname);
|
||||
snprintf(map->relname, sizeof(map->relname), "%s", old_rel->relname);
|
||||
|
Loading…
Reference in New Issue
Block a user