]> granicus.if.org Git - postgresql/commitdiff
In pg_upgrade, limit schema name filter to include toast tables. Bug
authorBruce Momjian <bruce@momjian.us>
Fri, 26 Aug 2011 04:12:32 +0000 (00:12 -0400)
committerBruce Momjian <bruce@momjian.us>
Fri, 26 Aug 2011 04:12:32 +0000 (00:12 -0400)
introduced recently when trying to filter out temp tables.

Backpatch to 9.0 and 9.1.

contrib/pg_upgrade/info.c
contrib/pg_upgrade/version_old_8_3.c

index 3ef342911eb2f9cbade98ff372761df518bd71ff..10188ca0f5e60cab047be3681a57d75a0ebcbfcb 100644 (file)
@@ -266,9 +266,10 @@ get_rel_infos(ClusterInfo *cluster, DbInfo *dbinfo)
                         "  LEFT OUTER JOIN pg_catalog.pg_tablespace t "
                         "         ON c.reltablespace = t.oid "
                         "WHERE relkind IN ('r','t', 'i'%s) AND "
-                        /* exclude pg_catalog and pg_temp_ (could be orphaned tables) */
-                        "  ((n.nspname !~ '^pg_' AND "
-                       "     n.nspname NOT IN ('information_schema', 'binary_upgrade') AND "
+                        /* exclude possible orphaned temp tables */
+                        "  ((n.nspname !~ '^pg_temp_' AND "
+                        "    n.nspname !~ '^pg_toast_temp_' AND "
+                        "    n.nspname NOT IN ('pg_catalog', 'information_schema', 'binary_upgrade') AND "
                         "        c.oid >= %u) "
                         "  OR (n.nspname = 'pg_catalog' AND "
        "    relname IN ('pg_largeobject', 'pg_largeobject_loid_pn_index'%s) )) "
index 1c736d256f903ae1866170632bbbe51f3022bfda..d63050c5b514c567503c57fb2ff65fd0849c6b8e 100644 (file)
@@ -59,9 +59,10 @@ old_8_3_check_for_name_data_type_usage(ClusterInfo *cluster)
                                                                "               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 possible orphaned temp tables */
+                                                               "               n.nspname !~ '^pg_temp_' AND "
+                                                               "               n.nspname !~ '^pg_toast_temp_' AND "
+                                                               "               n.nspname NOT IN ('pg_catalog', 'information_schema')");
 
                ntups = PQntuples(res);
                i_nspname = PQfnumber(res, "nspname");
@@ -149,9 +150,10 @@ old_8_3_check_for_tsquery_usage(ClusterInfo *cluster)
                                                                "               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 possible orphaned temp tables */
+                                                               "               n.nspname !~ '^pg_temp_' AND "
+                                                               "               n.nspname !~ '^pg_toast_temp_' AND "
+                                                               "               n.nspname NOT IN ('pg_catalog', 'information_schema')");
 
                ntups = PQntuples(res);
                i_nspname = PQfnumber(res, "nspname");
@@ -247,9 +249,10 @@ old_8_3_rebuild_tsvector_tables(ClusterInfo *cluster, 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 possible orphaned temp tables */
+                                                               "               n.nspname !~ '^pg_temp_' AND "
+                                                               "               n.nspname !~ '^pg_toast_temp_' AND "
+                                                               "               n.nspname NOT IN ('pg_catalog', 'information_schema')");
 
 /*
  *     This macro is used below to avoid reindexing indexes already rebuilt
@@ -619,9 +622,10 @@ old_8_3_create_sequence_script(ClusterInfo *cluster)
                                                                "               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 possible orphaned temp tables */
+                                                               "               n.nspname !~ '^pg_temp_' AND "
+                                                               "               n.nspname !~ '^pg_toast_temp_' AND "
+                                                               "               n.nspname NOT IN ('pg_catalog', 'information_schema')");
 
                ntups = PQntuples(res);
                i_nspname = PQfnumber(res, "nspname");