summaryrefslogtreecommitdiff
path: root/src/bin/pg_upgrade/version.c
diff options
context:
space:
mode:
authorTom Lane2021-12-15 00:17:55 +0000
committerTom Lane2021-12-15 00:17:55 +0000
commite469f0aaf3c586c8390bd65923f97d4b1683cd9f (patch)
tree2e8998bbd9036357c4e667ac86167b7c067dda77 /src/bin/pg_upgrade/version.c
parent30e7c175b81d53c0f60f6ad12d1913a6d7d77008 (diff)
Remove pg_upgrade support for upgrading from pre-9.2 servers.
Per discussion, we'll limit support for old servers to those branches that can still be built easily on modern platforms, which as of now is 9.2 and up. Discussion: https://postgr.es/m/[email protected]
Diffstat (limited to 'src/bin/pg_upgrade/version.c')
-rw-r--r--src/bin/pg_upgrade/version.c134
1 files changed, 23 insertions, 111 deletions
diff --git a/src/bin/pg_upgrade/version.c b/src/bin/pg_upgrade/version.c
index ccb012657be..0c00bc542c6 100644
--- a/src/bin/pg_upgrade/version.c
+++ b/src/bin/pg_upgrade/version.c
@@ -13,88 +13,6 @@
#include "fe_utils/string_utils.h"
#include "pg_upgrade.h"
-/*
- * new_9_0_populate_pg_largeobject_metadata()
- * new >= 9.0, old <= 8.4
- * 9.0 has a new pg_largeobject permission table
- */
-void
-new_9_0_populate_pg_largeobject_metadata(ClusterInfo *cluster, bool check_mode)
-{
- int dbnum;
- FILE *script = NULL;
- bool found = false;
- char output_path[MAXPGPATH];
-
- prep_status("Checking for large objects");
-
- snprintf(output_path, sizeof(output_path), "pg_largeobject.sql");
-
- for (dbnum = 0; dbnum < cluster->dbarr.ndbs; dbnum++)
- {
- PGresult *res;
- int i_count;
- DbInfo *active_db = &cluster->dbarr.dbs[dbnum];
- PGconn *conn = connectToServer(cluster, active_db->db_name);
-
- /* find if there are any large objects */
- res = executeQueryOrDie(conn,
- "SELECT count(*) "
- "FROM pg_catalog.pg_largeobject ");
-
- i_count = PQfnumber(res, "count");
- if (atoi(PQgetvalue(res, 0, i_count)) != 0)
- {
- found = true;
- if (!check_mode)
- {
- PQExpBufferData connectbuf;
-
- if (script == NULL && (script = fopen_priv(output_path, "w")) == NULL)
- pg_fatal("could not open file \"%s\": %s\n", output_path,
- strerror(errno));
-
- initPQExpBuffer(&connectbuf);
- appendPsqlMetaConnect(&connectbuf, active_db->db_name);
- fputs(connectbuf.data, script);
- termPQExpBuffer(&connectbuf);
-
- fprintf(script,
- "SELECT pg_catalog.lo_create(t.loid)\n"
- "FROM (SELECT DISTINCT loid FROM pg_catalog.pg_largeobject) AS t;\n");
- }
- }
-
- PQclear(res);
- PQfinish(conn);
- }
-
- if (script)
- fclose(script);
-
- if (found)
- {
- report_status(PG_WARNING, "warning");
- if (check_mode)
- pg_log(PG_WARNING, "\n"
- "Your installation contains large objects. The new database has an\n"
- "additional large object permission table. After upgrading, you will be\n"
- "given a command to populate the pg_largeobject_metadata table with\n"
- "default permissions.\n\n");
- else
- pg_log(PG_WARNING, "\n"
- "Your installation contains large objects. The new database has an\n"
- "additional large object permission table, so default permissions must be\n"
- "defined for all large objects. The file\n"
- " %s\n"
- "when executed by psql by the database superuser will set the default\n"
- "permissions.\n\n",
- output_path);
- }
- else
- check_ok();
-}
-
/*
* check_for_data_types_usage()
@@ -158,38 +76,32 @@ check_for_data_types_usage(ClusterInfo *cluster,
" t.oid = c.reltype AND "
" c.oid = a.attrelid AND "
" NOT a.attisdropped AND "
- " a.atttypid = x.oid ",
- base_query);
-
- /* Ranges were introduced in 9.2 */
- if (GET_MAJOR_VERSION(cluster->major_version) >= 902)
- appendPQExpBufferStr(&querybuf,
- " UNION ALL "
- /* ranges containing any type selected so far */
- " SELECT t.oid FROM pg_catalog.pg_type t, pg_catalog.pg_range r, x "
- " WHERE t.typtype = 'r' AND r.rngtypid = t.oid AND r.rngsubtype = x.oid");
-
- appendPQExpBufferStr(&querybuf,
- " ) foo "
- ") "
+ " a.atttypid = x.oid "
+ " UNION ALL "
+ /* ranges containing any type selected so far */
+ " SELECT t.oid FROM pg_catalog.pg_type t, pg_catalog.pg_range r, x "
+ " WHERE t.typtype = 'r' AND r.rngtypid = t.oid AND r.rngsubtype = x.oid"
+ " ) foo "
+ ") "
/* now look for stored columns of any such type */
- "SELECT n.nspname, c.relname, a.attname "
- "FROM pg_catalog.pg_class c, "
- " pg_catalog.pg_namespace n, "
- " pg_catalog.pg_attribute a "
- "WHERE c.oid = a.attrelid AND "
- " NOT a.attisdropped AND "
- " a.atttypid IN (SELECT oid FROM oids) AND "
- " c.relkind IN ("
- CppAsString2(RELKIND_RELATION) ", "
- CppAsString2(RELKIND_MATVIEW) ", "
- CppAsString2(RELKIND_INDEX) ") AND "
- " c.relnamespace = n.oid AND "
+ "SELECT n.nspname, c.relname, a.attname "
+ "FROM pg_catalog.pg_class c, "
+ " pg_catalog.pg_namespace n, "
+ " pg_catalog.pg_attribute a "
+ "WHERE c.oid = a.attrelid AND "
+ " NOT a.attisdropped AND "
+ " a.atttypid IN (SELECT oid FROM oids) AND "
+ " c.relkind IN ("
+ CppAsString2(RELKIND_RELATION) ", "
+ CppAsString2(RELKIND_MATVIEW) ", "
+ CppAsString2(RELKIND_INDEX) ") AND "
+ " c.relnamespace = n.oid AND "
/* exclude possible orphaned temp tables */
- " n.nspname !~ '^pg_temp_' AND "
- " n.nspname !~ '^pg_toast_temp_' AND "
+ " n.nspname !~ '^pg_temp_' AND "
+ " n.nspname !~ '^pg_toast_temp_' AND "
/* exclude system catalogs, too */
- " n.nspname NOT IN ('pg_catalog', 'information_schema')");
+ " n.nspname NOT IN ('pg_catalog', 'information_schema')",
+ base_query);
res = executeQueryOrDie(conn, "%s", querybuf.data);