1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-18 17:42:25 +03:00

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.
This commit is contained in:
Bruce Momjian
2011-08-26 00:12:39 -04:00
parent 9354f5b76a
commit df957a79cc
2 changed files with 30 additions and 17 deletions

View File

@ -328,7 +328,9 @@ get_rel_infos(migratorContext *ctx, const DbInfo *dbinfo,
" ON c.reltablespace = t.oid " " ON c.reltablespace = t.oid "
"WHERE (( " "WHERE (( "
/* exclude pg_catalog and pg_temp_ (could be orphaned tables) */ /* exclude pg_catalog and pg_temp_ (could be orphaned tables) */
" n.nspname !~ '^pg_' " " n.nspname != 'pg_catalog' "
" AND n.nspname !~ '^pg_temp_' "
" AND n.nspname !~ '^pg_toast_temp_' "
" AND n.nspname != 'information_schema' " " AND n.nspname != 'information_schema' "
" AND c.oid >= %u " " AND c.oid >= %u "
" ) OR ( " " ) OR ( "

View File

@ -61,8 +61,10 @@ old_8_3_check_for_name_data_type_usage(migratorContext *ctx, Cluster whichCluste
" NOT a.attisdropped AND " " NOT a.attisdropped AND "
" a.atttypid = 'pg_catalog.name'::pg_catalog.regtype AND " " a.atttypid = 'pg_catalog.name'::pg_catalog.regtype AND "
" c.relnamespace = n.oid AND " " c.relnamespace = n.oid AND "
/* exclude pg_catalog and pg_temp_ (could be orphaned tables) */ /* exclude possibly orphaned temp tables */
" n.nspname !~ '^pg_' AND " " n.nspname != 'pg_catalog' AND "
" n.nspname !~ '^pg_temp_' AND "
" n.nspname !~ '^pg_toast_temp_' AND "
" n.nspname != 'information_schema' "); " n.nspname != 'information_schema' ");
ntups = PQntuples(res); ntups = PQntuples(res);
@ -152,8 +154,10 @@ old_8_3_check_for_tsquery_usage(migratorContext *ctx, Cluster whichCluster)
" NOT a.attisdropped AND " " NOT a.attisdropped AND "
" a.atttypid = 'pg_catalog.tsquery'::pg_catalog.regtype AND " " a.atttypid = 'pg_catalog.tsquery'::pg_catalog.regtype AND "
" c.relnamespace = n.oid AND " " c.relnamespace = n.oid AND "
/* exclude pg_catalog and pg_temp_ (could be orphaned tables) */ /* exclude possibly orphaned temp tables */
" n.nspname !~ '^pg_' AND " " n.nspname != 'pg_catalog' AND "
" n.nspname !~ '^pg_temp_' AND "
" n.nspname !~ '^pg_toast_temp_' AND "
" n.nspname != 'information_schema' "); " n.nspname != 'information_schema' ");
ntups = PQntuples(res); ntups = PQntuples(res);
@ -252,8 +256,10 @@ old_8_3_rebuild_tsvector_tables(migratorContext *ctx, bool check_mode,
" NOT a.attisdropped AND " " NOT a.attisdropped AND "
" a.atttypid = 'pg_catalog.tsvector'::pg_catalog.regtype AND " " a.atttypid = 'pg_catalog.tsvector'::pg_catalog.regtype AND "
" c.relnamespace = n.oid AND " " c.relnamespace = n.oid AND "
/* exclude pg_catalog and pg_temp_ (could be orphaned tables) */ /* exclude possibly orphaned temp tables */
" n.nspname !~ '^pg_' AND " " n.nspname != 'pg_catalog' AND "
" n.nspname !~ '^pg_temp_' AND "
" n.nspname !~ '^pg_toast_temp_' AND "
" n.nspname != 'information_schema' "); " n.nspname != 'information_schema' ");
/* /*
@ -271,7 +277,9 @@ old_8_3_rebuild_tsvector_tables(migratorContext *ctx, bool check_mode,
" NOT a.attisdropped AND " \ " NOT a.attisdropped AND " \
" a.atttypid = 'pg_catalog.tsvector'::pg_catalog.regtype AND " \ " a.atttypid = 'pg_catalog.tsvector'::pg_catalog.regtype AND " \
" c.relnamespace = n.oid AND " \ " c.relnamespace = n.oid AND " \
" n.nspname !~ '^pg_' AND " \ " n.nspname != 'pg_catalog' AND " \
" n.nspname !~ '^pg_temp_' AND " \
" n.nspname !~ '^pg_toast_temp_' AND " \
" n.nspname != 'information_schema')" " n.nspname != 'information_schema')"
ntups = PQntuples(res); ntups = PQntuples(res);
@ -641,10 +649,13 @@ old_8_3_create_sequence_script(migratorContext *ctx, Cluster whichCluster)
" pg_catalog.pg_namespace n " " pg_catalog.pg_namespace n "
"WHERE c.relkind = 'S' AND " "WHERE c.relkind = 'S' AND "
" c.relnamespace = n.oid AND " " c.relnamespace = n.oid AND "
/* exclude pg_catalog and pg_temp_ (could be orphaned tables) */ /* exclude possibly orphaned temp tables */
" n.nspname !~ '^pg_' AND " " n.nspname != 'pg_catalog' AND "
" n.nspname !~ '^pg_temp_' AND "
" n.nspname !~ '^pg_toast_temp_' AND "
" n.nspname != 'information_schema' "); " n.nspname != 'information_schema' ");
ntups = PQntuples(res); ntups = PQntuples(res);
i_nspname = PQfnumber(res, "nspname"); i_nspname = PQfnumber(res, "nspname");
i_relname = PQfnumber(res, "relname"); i_relname = PQfnumber(res, "relname");