Skip to content

Commit e69d321

Browse files
committed
Simplify structure of query used to gather database object information
in pg_upgrade.
1 parent d8d4298 commit e69d321

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

contrib/pg_upgrade/info.c

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -255,27 +255,25 @@ get_rel_infos(ClusterInfo *cluster, DbInfo *dbinfo)
255255
snprintf(query, sizeof(query),
256256
"SELECT c.oid, n.nspname, c.relname, "
257257
" c.relfilenode, t.spclocation "
258-
"FROM pg_catalog.pg_class c JOIN "
259-
" pg_catalog.pg_namespace n "
260-
" ON c.relnamespace = n.oid "
261-
" LEFT OUTER JOIN pg_catalog.pg_tablespace t "
262-
" ON c.reltablespace = t.oid "
263-
"WHERE (( n.nspname NOT IN ('pg_catalog', 'information_schema', 'binary_upgrade') "
264-
" AND c.oid >= %u "
265-
" ) OR ( "
266-
" n.nspname = 'pg_catalog' "
267-
" AND relname IN "
268-
" ('pg_largeobject', 'pg_largeobject_loid_pn_index'%s) )) "
269-
" AND relkind IN ('r','t', 'i'%s) "
258+
"FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n "
259+
" ON c.relnamespace = n.oid "
260+
" LEFT OUTER JOIN pg_catalog.pg_tablespace t "
261+
" ON c.reltablespace = t.oid "
262+
"WHERE relkind IN ('r','t', 'i'%s) AND "
263+
" ((n.nspname NOT IN ('pg_catalog', 'information_schema', 'binary_upgrade') AND "
264+
" c.oid >= %u) "
265+
" OR (n.nspname = 'pg_catalog' AND "
266+
" relname IN ('pg_largeobject', 'pg_largeobject_loid_pn_index'%s) )) "
270267
/* we preserve pg_class.oid so we sort by it to match old/new */
271268
"ORDER BY 1;",
269+
/* see the comment at the top of old_8_3_create_sequence_script() */
270+
(GET_MAJOR_VERSION(old_cluster.major_version) <= 803) ?
271+
"" : ", 'S'",
272+
/* this oid allows us to skip system toast tables */
272273
FirstNormalObjectId,
273274
/* does pg_largeobject_metadata need to be migrated? */
274275
(GET_MAJOR_VERSION(old_cluster.major_version) <= 804) ?
275-
"" : ", 'pg_largeobject_metadata', 'pg_largeobject_metadata_oid_index'",
276-
/* see the comment at the top of old_8_3_create_sequence_script() */
277-
(GET_MAJOR_VERSION(old_cluster.major_version) <= 803) ?
278-
"" : ", 'S'");
276+
"" : ", 'pg_largeobject_metadata', 'pg_largeobject_metadata_oid_index'");
279277

280278
res = executeQueryOrDie(conn, query);
281279

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy