summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2011-08-26 00:12:39 -0400
committerBruce Momjian <bruce@momjian.us>2011-08-26 00:12:39 -0400
commitdf957a79cc2600e9e172500939c82bcf100b4dfd (patch)
tree091ef65f31ccc1f48dae680c48201b509ce131ae
parent9354f5b76acf37c96ed0173ff8ab3e415bae2b04 (diff)
In pg_upgrade, limit schema name filter to include toast tables. Bug
introduced recently when trying to filter out temp tables. Backpatch to 9.0 and 9.1.
-rw-r--r--contrib/pg_upgrade/info.c8
-rw-r--r--contrib/pg_upgrade/version_old_8_3.c39
2 files changed, 30 insertions, 17 deletions
diff --git a/contrib/pg_upgrade/info.c b/contrib/pg_upgrade/info.c
index ca357e78924..1f5b7ae70bf 100644
--- a/contrib/pg_upgrade/info.c
+++ b/contrib/pg_upgrade/info.c
@@ -328,9 +328,11 @@ get_rel_infos(migratorContext *ctx, const DbInfo *dbinfo,
" ON c.reltablespace = t.oid "
"WHERE (( "
/* exclude pg_catalog and pg_temp_ (could be orphaned tables) */
- " n.nspname !~ '^pg_' "
- " AND n.nspname != 'information_schema' "
- " AND c.oid >= %u "
+ " n.nspname != 'pg_catalog' "
+ " AND n.nspname !~ '^pg_temp_' "
+ " AND n.nspname !~ '^pg_toast_temp_' "
+ " AND n.nspname != 'information_schema' "
+ " AND c.oid >= %u "
" ) OR ( "
" n.nspname = 'pg_catalog' "
" AND relname IN "
diff --git a/contrib/pg_upgrade/version_old_8_3.c b/contrib/pg_upgrade/version_old_8_3.c
index 930f76d7146..6fcd61b9c4a 100644
--- a/contrib/pg_upgrade/version_old_8_3.c
+++ b/contrib/pg_upgrade/version_old_8_3.c
@@ -61,9 +61,11 @@ old_8_3_check_for_name_data_type_usage(migratorContext *ctx, Cluster whichCluste
" NOT a.attisdropped AND "
" a.atttypid = 'pg_catalog.name'::pg_catalog.regtype AND "
" c.relnamespace = n.oid AND "
- /* exclude pg_catalog and pg_temp_ (could be orphaned tables) */
- " n.nspname !~ '^pg_' AND "
- " n.nspname != 'information_schema'");
+ /* exclude possibly orphaned temp tables */
+ " n.nspname != 'pg_catalog' AND "
+ " n.nspname !~ '^pg_temp_' AND "
+ " n.nspname !~ '^pg_toast_temp_' AND "
+ " n.nspname != 'information_schema' ");
ntups = PQntuples(res);
i_nspname = PQfnumber(res, "nspname");
@@ -152,9 +154,11 @@ old_8_3_check_for_tsquery_usage(migratorContext *ctx, Cluster whichCluster)
" NOT a.attisdropped AND "
" a.atttypid = 'pg_catalog.tsquery'::pg_catalog.regtype AND "
" c.relnamespace = n.oid AND "
- /* exclude pg_catalog and pg_temp_ (could be orphaned tables) */
- " n.nspname !~ '^pg_' AND "
- " n.nspname != 'information_schema'");
+ /* exclude possibly orphaned temp tables */
+ " n.nspname != 'pg_catalog' AND "
+ " n.nspname !~ '^pg_temp_' AND "
+ " n.nspname !~ '^pg_toast_temp_' AND "
+ " n.nspname != 'information_schema' ");
ntups = PQntuples(res);
i_nspname = PQfnumber(res, "nspname");
@@ -252,9 +256,11 @@ old_8_3_rebuild_tsvector_tables(migratorContext *ctx, bool check_mode,
" NOT a.attisdropped AND "
" a.atttypid = 'pg_catalog.tsvector'::pg_catalog.regtype AND "
" c.relnamespace = n.oid AND "
- /* exclude pg_catalog and pg_temp_ (could be orphaned tables) */
- " n.nspname !~ '^pg_' AND "
- " n.nspname != 'information_schema'");
+ /* exclude possibly orphaned temp tables */
+ " n.nspname != 'pg_catalog' AND "
+ " n.nspname !~ '^pg_temp_' AND "
+ " n.nspname !~ '^pg_toast_temp_' AND "
+ " n.nspname != 'information_schema' ");
/*
* This macro is used below to avoid reindexing indexes already rebuilt
@@ -271,8 +277,10 @@ old_8_3_rebuild_tsvector_tables(migratorContext *ctx, bool check_mode,
" NOT a.attisdropped AND " \
" a.atttypid = 'pg_catalog.tsvector'::pg_catalog.regtype AND " \
" c.relnamespace = n.oid AND " \
- " n.nspname !~ '^pg_' AND " \
- " n.nspname != 'information_schema') "
+ " n.nspname != 'pg_catalog' AND " \
+ " n.nspname !~ '^pg_temp_' AND " \
+ " n.nspname !~ '^pg_toast_temp_' AND " \
+ " n.nspname != 'information_schema')"
ntups = PQntuples(res);
i_nspname = PQfnumber(res, "nspname");
@@ -641,9 +649,12 @@ old_8_3_create_sequence_script(migratorContext *ctx, Cluster whichCluster)
" pg_catalog.pg_namespace n "
"WHERE c.relkind = 'S' AND "
" c.relnamespace = n.oid AND "
- /* exclude pg_catalog and pg_temp_ (could be orphaned tables) */
- " n.nspname !~ '^pg_' AND "
- " n.nspname != 'information_schema'");
+ /* exclude possibly orphaned temp tables */
+ " n.nspname != 'pg_catalog' AND "
+ " n.nspname !~ '^pg_temp_' AND "
+ " n.nspname !~ '^pg_toast_temp_' AND "
+ " n.nspname != 'information_schema' ");
+
ntups = PQntuples(res);
i_nspname = PQfnumber(res, "nspname");