mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-15 08:20:16 +08:00
Simplify structure of query used to gather database object information
in pg_upgrade.
This commit is contained in:
parent
d8d429890d
commit
e69d32158c
@ -255,27 +255,25 @@ get_rel_infos(ClusterInfo *cluster, DbInfo *dbinfo)
|
|||||||
snprintf(query, sizeof(query),
|
snprintf(query, sizeof(query),
|
||||||
"SELECT c.oid, n.nspname, c.relname, "
|
"SELECT c.oid, n.nspname, c.relname, "
|
||||||
" c.relfilenode, t.spclocation "
|
" c.relfilenode, t.spclocation "
|
||||||
"FROM pg_catalog.pg_class c JOIN "
|
"FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n "
|
||||||
" pg_catalog.pg_namespace n "
|
" ON c.relnamespace = n.oid "
|
||||||
" ON c.relnamespace = n.oid "
|
" LEFT OUTER JOIN pg_catalog.pg_tablespace t "
|
||||||
" LEFT OUTER JOIN pg_catalog.pg_tablespace t "
|
" ON c.reltablespace = t.oid "
|
||||||
" ON c.reltablespace = t.oid "
|
"WHERE relkind IN ('r','t', 'i'%s) AND "
|
||||||
"WHERE (( n.nspname NOT IN ('pg_catalog', 'information_schema', 'binary_upgrade') "
|
" ((n.nspname NOT IN ('pg_catalog', 'information_schema', 'binary_upgrade') AND "
|
||||||
" AND c.oid >= %u "
|
" c.oid >= %u) "
|
||||||
" ) OR ( "
|
" OR (n.nspname = 'pg_catalog' AND "
|
||||||
" n.nspname = 'pg_catalog' "
|
" relname IN ('pg_largeobject', 'pg_largeobject_loid_pn_index'%s) )) "
|
||||||
" AND relname IN "
|
|
||||||
" ('pg_largeobject', 'pg_largeobject_loid_pn_index'%s) )) "
|
|
||||||
" AND relkind IN ('r','t', 'i'%s) "
|
|
||||||
/* we preserve pg_class.oid so we sort by it to match old/new */
|
/* we preserve pg_class.oid so we sort by it to match old/new */
|
||||||
"ORDER BY 1;",
|
"ORDER BY 1;",
|
||||||
|
/* see the comment at the top of old_8_3_create_sequence_script() */
|
||||||
|
(GET_MAJOR_VERSION(old_cluster.major_version) <= 803) ?
|
||||||
|
"" : ", 'S'",
|
||||||
|
/* this oid allows us to skip system toast tables */
|
||||||
FirstNormalObjectId,
|
FirstNormalObjectId,
|
||||||
/* does pg_largeobject_metadata need to be migrated? */
|
/* does pg_largeobject_metadata need to be migrated? */
|
||||||
(GET_MAJOR_VERSION(old_cluster.major_version) <= 804) ?
|
(GET_MAJOR_VERSION(old_cluster.major_version) <= 804) ?
|
||||||
"" : ", 'pg_largeobject_metadata', 'pg_largeobject_metadata_oid_index'",
|
"" : ", 'pg_largeobject_metadata', 'pg_largeobject_metadata_oid_index'");
|
||||||
/* see the comment at the top of old_8_3_create_sequence_script() */
|
|
||||||
(GET_MAJOR_VERSION(old_cluster.major_version) <= 803) ?
|
|
||||||
"" : ", 'S'");
|
|
||||||
|
|
||||||
res = executeQueryOrDie(conn, query);
|
res = executeQueryOrDie(conn, query);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user