Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9e5bed2

Browse files
committed
Restructure pg_upgrade checks because pre-8.4 Postgres did not rename
toast file names to match the new relfilenode.
1 parentf7b70df commit9e5bed2

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

‎contrib/pg_upgrade/info.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,18 @@ gen_db_file_maps(DbInfo *old_db, DbInfo *new_db,
5151
RelInfo*new_rel=&new_db->rel_arr.rels[relnum];
5252

5353
if (old_rel->reloid!=new_rel->reloid)
54-
pg_log(PG_FATAL,"mismatch of relation id: database \"%s\", old relid %d, new relid %d\n",
54+
pg_log(PG_FATAL,"Mismatch of relation id: database \"%s\", old relid %d, new relid %d\n",
5555
old_db->db_name,old_rel->reloid,new_rel->reloid);
56-
56+
57+
/* toast names were not renamed to match their relfilenodes in pre-8.4 */
58+
if (GET_MAJOR_VERSION(old_cluster.major_version) >=804&&
59+
(strcmp(old_rel->nspname,new_rel->nspname)!=0||
60+
strcmp(old_rel->relname,new_rel->relname)!=0))
61+
pg_log(PG_FATAL,"Mismatch of relation names: database \"%s\", "
62+
"old rel %s.%s, new rel %s.%s\n",
63+
old_db->db_name,old_rel->nspname,old_rel->relname,
64+
new_rel->nspname,new_rel->relname);
65+
5766
create_rel_filename_map(old_pgdata,new_pgdata,old_db,new_db,
5867
old_rel,new_rel,maps+num_maps);
5968
num_maps++;
@@ -104,12 +113,6 @@ create_rel_filename_map(const char *old_data, const char *new_data,
104113
/* new_relfilenode will match old and new pg_class.oid */
105114
map->new_relfilenode=new_rel->relfilenode;
106115

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->db_name,old_rel->nspname,old_rel->relname,
111-
new_rel->nspname,new_rel->relname);
112-
113116
/* used only for logging and error reporing, old/new are identical */
114117
snprintf(map->nspname,sizeof(map->nspname),"%s",old_rel->nspname);
115118
snprintf(map->relname,sizeof(map->relname),"%s",old_rel->relname);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp