(unnamed)

text/plain

Filename: (unnamed)
Type: text/plain
Part: 1
Message: pg_upgrade fixes, #99 ;-)
commit a60b32b3dcb4d49a60c96558ce405764ac17c799
Author: Bruce Momjian <bruce@momjian.us>
Date:   Sat Jan 8 08:01:12 2011 -0500

    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.

diff --git a/contrib/pg_upgrade/info.c b/contrib/pg_upgrade/info.c
index 4360d39..50e4de2 100644
*** /tmp/W2sFHd_info.c	Sat Jan  8 13:46:40 2011
--- /tmp/2POKce_info.c	Sat Jan  8 13:46:40 2011
*************** gen_db_file_maps(DbInfo *old_db, DbInfo 
*** 50,59 ****
  		RelInfo    *old_rel = &old_db->rel_arr.rels[relnum];
  		RelInfo    *new_rel;
  
- 		/* toast tables are handled by their parents */
- 		if (strcmp(old_rel->nspname, "pg_toast") == 0)
- 			continue;
- 
  		/* old/new relation names always match */
  		new_rel = relarr_lookup_rel_name(&new_cluster, &new_db->rel_arr,
  								   old_rel->nspname, old_rel->relname);
--- 50,55 ----
*************** gen_db_file_maps(DbInfo *old_db, DbInfo 
*** 61,99 ****
  		create_rel_filename_map(old_pgdata, new_pgdata, old_db, new_db,
  				old_rel, new_rel, maps + num_maps);
  		num_maps++;
- 
- 		/*
- 		 * So much for mapping this relation;  now we need a mapping
- 		 * for its corresponding toast relation and toast index, if any.
- 		 */
- 		if (old_rel->toastrelid > 0)
- 		{
- 			char		old_name[MAXPGPATH], new_name[MAXPGPATH];
- 			RelInfo    *old_toast, *new_toast;
- 
- 			/* use the toast relids from the rel_arr for lookups */
- 			old_toast = relarr_lookup_rel_oid(&old_cluster, &old_db->rel_arr,
- 											  old_rel->toastrelid);
- 			new_toast = relarr_lookup_rel_oid(&new_cluster, &new_db->rel_arr,
- 											  new_rel->toastrelid);
- 
- 			create_rel_filename_map(old_pgdata, new_pgdata, old_db, new_db,
- 					old_toast, new_toast, maps + num_maps);
- 			num_maps++;
- 
- 			/* toast indexes are the same, except with an "_index" suffix */
- 			snprintf(old_name, sizeof(old_name), "%s_index", old_toast->relname);
- 			snprintf(new_name, sizeof(new_name), "%s_index", new_toast->relname);
- 
- 			old_toast = relarr_lookup_rel_name(&old_cluster, &old_db->rel_arr,
- 										  "pg_toast", old_name);
- 			new_toast = relarr_lookup_rel_name(&new_cluster, &new_db->rel_arr,
- 										  "pg_toast", new_name);
- 
- 			create_rel_filename_map(old_pgdata, new_pgdata, old_db,
- 					new_db, old_toast, new_toast, maps + num_maps);
- 			num_maps++;
- 		}
  	}
  
  	*nmaps = num_maps;
--- 57,62 ----