Skip to content

Commit a60b32b

Browse files
committed
In pg_upgrade, remove unnecessary separate handling of toast tables now
that we restore by oid; they can be handled like regular tables when creating the file mapping structure.
1 parent af84bee commit a60b32b

File tree

1 file changed

+0
-37
lines changed

1 file changed

+0
-37
lines changed

contrib/pg_upgrade/info.c

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -50,50 +50,13 @@ gen_db_file_maps(DbInfo *old_db, DbInfo *new_db,
5050
RelInfo *old_rel = &old_db->rel_arr.rels[relnum];
5151
RelInfo *new_rel;
5252

53-
/* toast tables are handled by their parents */
54-
if (strcmp(old_rel->nspname, "pg_toast") == 0)
55-
continue;
56-
5753
/* old/new relation names always match */
5854
new_rel = relarr_lookup_rel_name(&new_cluster, &new_db->rel_arr,
5955
old_rel->nspname, old_rel->relname);
6056

6157
create_rel_filename_map(old_pgdata, new_pgdata, old_db, new_db,
6258
old_rel, new_rel, maps + num_maps);
6359
num_maps++;
64-
65-
/*
66-
* So much for mapping this relation; now we need a mapping
67-
* for its corresponding toast relation and toast index, if any.
68-
*/
69-
if (old_rel->toastrelid > 0)
70-
{
71-
char old_name[MAXPGPATH], new_name[MAXPGPATH];
72-
RelInfo *old_toast, *new_toast;
73-
74-
/* use the toast relids from the rel_arr for lookups */
75-
old_toast = relarr_lookup_rel_oid(&old_cluster, &old_db->rel_arr,
76-
old_rel->toastrelid);
77-
new_toast = relarr_lookup_rel_oid(&new_cluster, &new_db->rel_arr,
78-
new_rel->toastrelid);
79-
80-
create_rel_filename_map(old_pgdata, new_pgdata, old_db, new_db,
81-
old_toast, new_toast, maps + num_maps);
82-
num_maps++;
83-
84-
/* toast indexes are the same, except with an "_index" suffix */
85-
snprintf(old_name, sizeof(old_name), "%s_index", old_toast->relname);
86-
snprintf(new_name, sizeof(new_name), "%s_index", new_toast->relname);
87-
88-
old_toast = relarr_lookup_rel_name(&old_cluster, &old_db->rel_arr,
89-
"pg_toast", old_name);
90-
new_toast = relarr_lookup_rel_name(&new_cluster, &new_db->rel_arr,
91-
"pg_toast", new_name);
92-
93-
create_rel_filename_map(old_pgdata, new_pgdata, old_db,
94-
new_db, old_toast, new_toast, maps + num_maps);
95-
num_maps++;
96-
}
9760
}
9861

9962
*nmaps = num_maps;

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