12 #include "catalog/pg_authid_d.h"
13 #include "catalog/pg_class_d.h"
61 #define MANUAL_CHECK 1
62 #define ALL_VERSIONS -1
112 .report_filename =
"tables_using_composite.txt",
114 "SELECT t.oid FROM pg_catalog.pg_type t "
115 "LEFT JOIN pg_catalog.pg_namespace n ON t.typnamespace = n.oid "
116 " WHERE typtype = 'c' AND (t.oid < 16384 OR nspname = 'information_schema')",
118 gettext_noop(
"Your installation contains system-defined composite types in user tables.\n"
119 "These type OIDs are not stable across PostgreSQL versions,\n"
120 "so this cluster cannot currently be upgraded. You can drop the\n"
121 "problem columns and restart the upgrade.\n"),
132 .status =
gettext_noop(
"Checking for incompatible \"line\" data type"),
133 .report_filename =
"tables_using_line.txt",
135 "SELECT 'pg_catalog.line'::pg_catalog.regtype AS oid",
137 gettext_noop(
"Your installation contains the \"line\" data type in user tables.\n"
138 "This data type changed its internal and input/output format\n"
139 "between your old and new versions so this\n"
140 "cluster cannot currently be upgraded. You can\n"
141 "drop the problem columns and restart the upgrade.\n"),
142 .threshold_version = 903
154 .status =
gettext_noop(
"Checking for reg* data types in user tables"),
155 .report_filename =
"tables_using_reg.txt",
163 "SELECT oid FROM pg_catalog.pg_type t "
164 "WHERE t.typnamespace = "
165 " (SELECT oid FROM pg_catalog.pg_namespace "
166 " WHERE nspname = 'pg_catalog') "
167 " AND t.typname IN ( "
181 gettext_noop(
"Your installation contains one of the reg* data types in user tables.\n"
182 "These data types reference system OIDs that are not preserved by\n"
183 "pg_upgrade, so this cluster cannot currently be upgraded. You can\n"
184 "drop the problem columns and restart the upgrade.\n"),
193 .status =
gettext_noop(
"Checking for incompatible \"aclitem\" data type"),
194 .report_filename =
"tables_using_aclitem.txt",
196 "SELECT 'pg_catalog.aclitem'::pg_catalog.regtype AS oid",
198 gettext_noop(
"Your installation contains the \"aclitem\" data type in user tables.\n"
199 "The internal format of \"aclitem\" changed in PostgreSQL version 16\n"
200 "so this cluster cannot currently be upgraded. You can drop the\n"
201 "problem columns and restart the upgrade.\n"),
202 .threshold_version = 1500
217 .status =
gettext_noop(
"Checking for invalid \"unknown\" user columns"),
218 .report_filename =
"tables_using_unknown.txt",
220 "SELECT 'pg_catalog.unknown'::pg_catalog.regtype AS oid",
222 gettext_noop(
"Your installation contains the \"unknown\" data type in user tables.\n"
223 "This data type is no longer allowed in tables, so this cluster\n"
224 "cannot currently be upgraded. You can drop the problem columns\n"
225 "and restart the upgrade.\n"),
226 .threshold_version = 906
239 .status =
gettext_noop(
"Checking for invalid \"sql_identifier\" user columns"),
240 .report_filename =
"tables_using_sql_identifier.txt",
242 "SELECT 'information_schema.sql_identifier'::pg_catalog.regtype AS oid",
244 gettext_noop(
"Your installation contains the \"sql_identifier\" data type in user tables.\n"
245 "The on-disk format for this data type has changed, so this\n"
246 "cluster cannot currently be upgraded. You can drop the problem\n"
247 "columns and restart the upgrade.\n"),
248 .threshold_version = 1100
255 .status =
gettext_noop(
"Checking for incompatible \"jsonb\" data type in user tables"),
256 .report_filename =
"tables_using_jsonb.txt",
258 "SELECT 'pg_catalog.jsonb'::pg_catalog.regtype AS oid",
260 gettext_noop(
"Your installation contains the \"jsonb\" data type in user tables.\n"
261 "The internal format of \"jsonb\" changed during 9.4 beta so this\n"
262 "cluster cannot currently be upgraded. You can drop the problem \n"
263 "columns and restart the upgrade.\n"),
272 .status =
gettext_noop(
"Checking for removed \"abstime\" data type in user tables"),
273 .report_filename =
"tables_using_abstime.txt",
275 "SELECT 'pg_catalog.abstime'::pg_catalog.regtype AS oid",
277 gettext_noop(
"Your installation contains the \"abstime\" data type in user tables.\n"
278 "The \"abstime\" type has been removed in PostgreSQL version 12,\n"
279 "so this cluster cannot currently be upgraded. You can drop the\n"
280 "problem columns, or change them to another data type, and restart\n"
282 .threshold_version = 1100
285 .status =
gettext_noop(
"Checking for removed \"reltime\" data type in user tables"),
286 .report_filename =
"tables_using_reltime.txt",
288 "SELECT 'pg_catalog.reltime'::pg_catalog.regtype AS oid",
290 gettext_noop(
"Your installation contains the \"reltime\" data type in user tables.\n"
291 "The \"reltime\" type has been removed in PostgreSQL version 12,\n"
292 "so this cluster cannot currently be upgraded. You can drop the\n"
293 "problem columns, or change them to another data type, and restart\n"
295 .threshold_version = 1100
298 .status =
gettext_noop(
"Checking for removed \"tinterval\" data type in user tables"),
299 .report_filename =
"tables_using_tinterval.txt",
301 "SELECT 'pg_catalog.tinterval'::pg_catalog.regtype AS oid",
303 gettext_noop(
"Your installation contains the \"tinterval\" data type in user tables.\n"
304 "The \"tinterval\" type has been removed in PostgreSQL version 12,\n"
305 "so this cluster cannot currently be upgraded. You can drop the\n"
306 "problem columns, or change them to another data type, and restart\n"
308 .threshold_version = 1100
313 NULL, NULL, NULL, NULL, 0, NULL
336 return psprintf(
"WITH RECURSIVE oids AS ( "
342 " WITH x AS (SELECT oid FROM oids) "
344 " SELECT t.oid FROM pg_catalog.pg_type t, x WHERE typbasetype = x.oid AND typtype = 'd' "
347 " SELECT t.oid FROM pg_catalog.pg_type t, x WHERE typelem = x.oid AND typtype = 'b' "
350 " SELECT t.oid FROM pg_catalog.pg_type t, pg_catalog.pg_class c, pg_catalog.pg_attribute a, x "
351 " WHERE t.typtype = 'c' AND "
352 " t.oid = c.reltype AND "
353 " c.oid = a.attrelid AND "
354 " NOT a.attisdropped AND "
355 " a.atttypid = x.oid "
358 " SELECT t.oid FROM pg_catalog.pg_type t, pg_catalog.pg_range r, x "
359 " WHERE t.typtype = 'r' AND r.rngtypid = t.oid AND r.rngsubtype = x.oid"
363 "SELECT n.nspname, c.relname, a.attname "
364 "FROM pg_catalog.pg_class c, "
365 " pg_catalog.pg_namespace n, "
366 " pg_catalog.pg_attribute a "
367 "WHERE c.oid = a.attrelid AND "
368 " NOT a.attisdropped AND "
369 " a.atttypid IN (SELECT oid FROM oids) AND "
374 " c.relnamespace = n.oid AND "
376 " n.nspname !~ '^pg_temp_' AND "
377 " n.nspname !~ '^pg_toast_temp_' AND "
379 " n.nspname NOT IN ('pg_catalog', 'information_schema')",
404 snprintf(output_path,
sizeof(output_path),
"%s/%s",
406 state->check->report_filename);
412 if (*
state->report == NULL)
423 _(
state->check->report_text),
424 _(
"A list of the problem columns is in the file:"),
427 state->result =
true;
429 if ((script =
fopen_priv(output_path,
"a")) == NULL)
430 pg_fatal(
"could not open file \"%s\": %m", output_path);
434 for (
int rowno = 0; rowno < ntups; rowno++)
467 int n_data_types_usage_checks = 0;
469 char **queries = NULL;
475 while (tmp->
status != NULL)
477 n_data_types_usage_checks++;
482 queries =
pg_malloc0(
sizeof(
char *) * n_data_types_usage_checks);
485 for (
int i = 0;
i < n_data_types_usage_checks;
i++)
530 for (
int i = 0;
i < n_data_types_usage_checks;
i++)
575 "Performing Consistency Checks on Old Live Server\n"
576 "------------------------------------------------");
581 "Performing Consistency Checks\n"
582 "-----------------------------");
739 "If pg_upgrade fails after this point, you must re-initdb the\n"
740 "new cluster before continuing.");
779 "Optimizer statistics are not transferred by pg_upgrade.\n"
780 "Once you start the new server, consider running:\n"
783 if (deletion_script_file_name)
785 "Running this script will delete the old cluster's data files:\n"
787 deletion_script_file_name);
790 "Could not create a script to delete the old cluster's data files\n"
791 "because user-defined tablespaces or the new cluster's data directory\n"
792 "exist in the old cluster directory. The old cluster's contents must\n"
793 "be deleted manually.");
814 pg_fatal(
"This utility can only upgrade from PostgreSQL version %s and later.",
819 pg_fatal(
"This utility can only upgrade to PostgreSQL version %s.",
828 pg_fatal(
"This utility cannot be used to downgrade to older major PostgreSQL versions.");
833 pg_fatal(
"Old cluster data and binary directories are from different major versions.");
836 pg_fatal(
"New cluster data and binary directories are from different major versions.");
851 pg_fatal(
"When checking a live server, "
852 "the old and new port numbers must be different.");
866 for (relnum = 0; relnum < rel_arr->
nrels;
870 if (strcmp(rel_arr->
rels[relnum].
nspname,
"pg_catalog") != 0)
871 pg_fatal(
"New cluster database \"%s\" is not empty: found relation \"%s.%s\"",
894 prep_status(
"Checking for new cluster tablespace directories");
904 if (
stat(new_tablespace_dir, &statbuf) == 0 || errno != ENOENT)
905 pg_fatal(
"new cluster tablespace directory already exists: \"%s\"",
925 *deletion_script_file_name =
psprintf(
"%sdelete_old_cluster.%s",
938 "\nWARNING: new data directory should not be inside the old data directory, i.e. %s", old_cluster_pgdata);
941 unlink(*deletion_script_file_name);
942 pg_free(*deletion_script_file_name);
943 *deletion_script_file_name = NULL;
962 "\nWARNING: user-defined tablespace locations should not be inside the data directory, i.e. %s", old_tablespace_dir);
965 unlink(*deletion_script_file_name);
966 pg_free(*deletion_script_file_name);
967 *deletion_script_file_name = NULL;
972 prep_status(
"Creating script to delete old cluster");
974 if ((script =
fopen_priv(*deletion_script_file_name,
"w")) == NULL)
975 pg_fatal(
"could not open file \"%s\": %m",
976 *deletion_script_file_name);
980 fprintf(script,
"#!/bin/sh\n\n");
1025 if (chmod(*deletion_script_file_name,
S_IRWXU) != 0)
1026 pg_fatal(
"could not add execute permission to file \"%s\": %m",
1027 *deletion_script_file_name);
1046 prep_status(
"Checking database user is the install user");
1050 "SELECT rolsuper, oid "
1051 "FROM pg_catalog.pg_roles "
1052 "WHERE rolname = current_user "
1053 "AND rolname !~ '^pg_'");
1062 pg_fatal(
"database user \"%s\" is not the install user",
1069 "FROM pg_catalog.pg_roles "
1070 "WHERE rolname !~ '^pg_'");
1073 pg_fatal(
"could not determine the number of users");
1081 pg_fatal(
"Only the install user can be defined in the new cluster.");
1107 FILE *script = NULL;
1110 prep_status(
"Checking database connection settings");
1112 snprintf(output_path,
sizeof(output_path),
"%s/%s",
1114 "databases_with_datallowconn_false.txt");
1120 "SELECT datname, datallowconn "
1121 "FROM pg_catalog.pg_database");
1123 i_datname =
PQfnumber(dbres,
"datname");
1124 i_datallowconn =
PQfnumber(dbres,
"datallowconn");
1127 for (dbnum = 0; dbnum < ntups; dbnum++)
1132 if (strcmp(
datname,
"template0") == 0)
1136 pg_fatal(
"template0 must not allow connections, "
1137 "i.e. its pg_database.datallowconn must be false");
1147 if (script == NULL && (script =
fopen_priv(output_path,
"w")) == NULL)
1148 pg_fatal(
"could not open file \"%s\": %m", output_path);
1163 pg_fatal(
"All non-template0 databases must allow connections, i.e. their\n"
1164 "pg_database.datallowconn must be true. Your installation contains\n"
1165 "non-template0 databases with their pg_database.datallowconn set to\n"
1166 "false. Consider allowing connection for all non-template0 databases\n"
1167 "or drop the databases which do not allow connections. A list of\n"
1168 "databases with the problem is in the file:\n"
1169 " %s", output_path);
1188 prep_status(
"Checking for prepared transactions");
1192 "FROM pg_catalog.pg_prepared_xacts");
1197 pg_fatal(
"The source cluster contains prepared transactions");
1199 pg_fatal(
"The target cluster contains prepared transactions");
1229 if (report->
file == NULL &&
1231 pg_fatal(
"could not open file \"%s\": %m", report->
path);
1235 for (
int rowno = 0; rowno < ntups; rowno++)
1253 const char *query =
"SELECT n.nspname, p.proname "
1254 "FROM pg_catalog.pg_proc p, "
1255 " pg_catalog.pg_namespace n "
1256 "WHERE p.pronamespace = n.oid AND "
1257 " p.probin = '$libdir/isn'";
1259 prep_status(
"Checking for contrib/isn with bigint-passing mismatch");
1272 "contrib_isn_and_int8_pass_by_value.txt");
1282 fclose(report.
file);
1284 pg_fatal(
"Your installation contains \"contrib/isn\" functions which rely on the\n"
1285 "bigint data type. Your old and new clusters pass bigint values\n"
1286 "differently so this cluster cannot currently be upgraded. You can\n"
1287 "manually dump databases in the old cluster that use \"contrib/isn\"\n"
1288 "facilities, drop them, perform the upgrade, and then restore them. A\n"
1289 "list of the problem functions is in the file:\n"
1290 " %s", report.
path);
1318 if (report->
file == NULL &&
1320 pg_fatal(
"could not open file \"%s\": %m", report->
path);
1324 for (
int rowno = 0; rowno < ntups; rowno++)
1325 fprintf(report->
file,
" (oid=%s) %s.%s (%s.%s, NONE)\n",
1349 query =
"SELECT o.oid AS oproid, "
1350 " n.nspname AS oprnsp, "
1352 " tn.nspname AS typnsp, "
1354 "FROM pg_catalog.pg_operator o, "
1355 " pg_catalog.pg_namespace n, "
1356 " pg_catalog.pg_type t, "
1357 " pg_catalog.pg_namespace tn "
1358 "WHERE o.oprnamespace = n.oid AND "
1359 " o.oprleft = t.oid AND "
1360 " t.typnamespace = tn.oid AND "
1361 " o.oprright = 0 AND "
1364 prep_status(
"Checking for user-defined postfix operators");
1378 fclose(report.
file);
1380 pg_fatal(
"Your installation contains user-defined postfix operators, which are not\n"
1381 "supported anymore. Consider dropping the postfix operators and replacing\n"
1382 "them with prefix operators or function calls.\n"
1383 "A list of user-defined postfix operators is in the file:\n"
1384 " %s", report.
path);
1409 if (report->
file == NULL &&
1411 pg_fatal(
"could not open file \"%s\": %m", report->
path);
1415 for (
int rowno = 0; rowno < ntups; rowno++)
1435 prep_status(
"Checking for incompatible polymorphic functions");
1440 "incompatible_polymorphics.txt");
1446 "'array_append(anyarray,anyelement)'"
1447 ", 'array_cat(anyarray,anyarray)'"
1448 ", 'array_prepend(anyelement,anyarray)'");
1452 ", 'array_remove(anyarray,anyelement)'"
1453 ", 'array_replace(anyarray,anyelement,anyelement)'");
1457 ", 'array_position(anyarray,anyelement)'"
1458 ", 'array_position(anyarray,anyelement,integer)'"
1459 ", 'array_positions(anyarray,anyelement)'"
1460 ", 'width_bucket(anyelement,anyarray)'");
1470 query =
psprintf(
"SELECT 'aggregate' AS objkind, p.oid::regprocedure::text AS objname "
1471 "FROM pg_proc AS p "
1472 "JOIN pg_aggregate AS a ON a.aggfnoid=p.oid "
1473 "JOIN pg_proc AS transfn ON transfn.oid=a.aggtransfn "
1474 "WHERE p.oid >= 16384 "
1475 "AND a.aggtransfn = ANY(ARRAY[%s]::regprocedure[]) "
1476 "AND a.aggtranstype = ANY(ARRAY['anyarray', 'anyelement']::regtype[]) "
1480 "SELECT 'aggregate' AS objkind, p.oid::regprocedure::text AS objname "
1481 "FROM pg_proc AS p "
1482 "JOIN pg_aggregate AS a ON a.aggfnoid=p.oid "
1483 "JOIN pg_proc AS finalfn ON finalfn.oid=a.aggfinalfn "
1484 "WHERE p.oid >= 16384 "
1485 "AND a.aggfinalfn = ANY(ARRAY[%s]::regprocedure[]) "
1486 "AND a.aggtranstype = ANY(ARRAY['anyarray', 'anyelement']::regtype[]) "
1490 "SELECT 'operator' AS objkind, op.oid::regoperator::text AS objname "
1491 "FROM pg_operator AS op "
1492 "WHERE op.oid >= 16384 "
1493 "AND oprcode = ANY(ARRAY[%s]::regprocedure[]) "
1494 "AND oprleft = ANY(ARRAY['anyarray', 'anyelement']::regtype[])",
1495 old_polymorphics.
data,
1496 old_polymorphics.
data,
1497 old_polymorphics.
data);
1506 fclose(report.
file);
1508 pg_fatal(
"Your installation contains user-defined objects that refer to internal\n"
1509 "polymorphic functions with arguments of type \"anyarray\" or \"anyelement\".\n"
1510 "These user-defined objects must be dropped before upgrading and restored\n"
1511 "afterwards, changing them to refer to the new corresponding functions with\n"
1512 "arguments of type \"anycompatiblearray\" and \"anycompatible\".\n"
1513 "A list of the problematic objects is in the file:\n"
1514 " %s", report.
path);
1541 if (report->
file == NULL &&
1543 pg_fatal(
"could not open file \"%s\": %m", report->
path);
1547 for (
int rowno = 0; rowno < ntups; rowno++)
1561 const char *query =
"SELECT n.nspname, c.relname "
1562 "FROM pg_catalog.pg_class c, "
1563 " pg_catalog.pg_namespace n "
1564 "WHERE c.relnamespace = n.oid AND "
1566 " n.nspname NOT IN ('pg_catalog')";
1573 "tables_with_oids.txt");
1582 fclose(report.
file);
1584 pg_fatal(
"Your installation contains tables declared WITH OIDS, which is not\n"
1585 "supported anymore. Consider removing the oid column using\n"
1586 " ALTER TABLE ... SET WITHOUT OIDS;\n"
1587 "A list of tables with the problem is in the file:\n"
1588 " %s", report.
path);
1608 FILE *script = NULL;
1611 prep_status(
"Checking for roles starting with \"pg_\"");
1613 snprintf(output_path,
sizeof(output_path),
"%s/%s",
1615 "pg_role_prefix.txt");
1618 "SELECT oid AS roloid, rolname "
1619 "FROM pg_catalog.pg_roles "
1620 "WHERE rolname ~ '^pg_'");
1625 for (
int rowno = 0; rowno < ntups; rowno++)
1627 if (script == NULL && (script =
fopen_priv(output_path,
"w")) == NULL)
1628 pg_fatal(
"could not open file \"%s\": %m", output_path);
1629 fprintf(script,
"%s (oid=%s)\n",
1642 pg_fatal(
"Your installation contains roles starting with \"pg_\".\n"
1643 "\"pg_\" is a reserved prefix for system roles. The cluster\n"
1644 "cannot be upgraded until these roles are renamed.\n"
1645 "A list of roles starting with \"pg_\" is in the file:\n"
1646 " %s", output_path);
1673 if (report->
file == NULL &&
1675 pg_fatal(
"could not open file \"%s\": %m", report->
path);
1679 for (
int rowno = 0; rowno < ntups; rowno++)
1696 prep_status(
"Checking for user-defined encoding conversions");
1701 "encoding_conversions.txt");
1709 query =
"SELECT c.oid as conoid, c.conname, n.nspname "
1710 "FROM pg_catalog.pg_conversion c, "
1711 " pg_catalog.pg_namespace n "
1712 "WHERE c.connamespace = n.oid AND "
1723 fclose(report.
file);
1725 pg_fatal(
"Your installation contains user-defined encoding conversions.\n"
1726 "The conversion function parameters changed in PostgreSQL version 14\n"
1727 "so this cluster cannot currently be upgraded. You can remove the\n"
1728 "encoding conversions in the old cluster and restart the upgrade.\n"
1729 "A list of user-defined encoding conversions is in the file:\n"
1730 " %s", report.
path);
1759 if (nslots_on_old == 0)
1764 prep_status(
"Checking for new cluster logical replication slots");
1767 "FROM pg_catalog.pg_replication_slots "
1768 "WHERE slot_type = 'logical' AND "
1769 "temporary IS FALSE;");
1772 pg_fatal(
"could not count the number of logical replication slots");
1777 pg_fatal(
"expected 0 logical replication slots but found %d",
1783 "WHERE name IN ('wal_level', 'max_replication_slots') "
1784 "ORDER BY name DESC;");
1787 pg_fatal(
"could not determine parameter settings on new cluster");
1792 pg_fatal(
"\"wal_level\" must be \"logical\" but is set to \"%s\"",
1798 pg_fatal(
"\"max_replication_slots\" (%d) must be greater than or equal to the number of "
1799 "logical replication slots (%d) on the old cluster",
1830 prep_status(
"Checking for new cluster configuration for subscriptions");
1835 "WHERE name = 'max_replication_slots';");
1838 pg_fatal(
"could not determine parameter settings on new cluster");
1842 pg_fatal(
"\"max_replication_slots\" (%d) must be greater than or equal to the number of "
1843 "subscriptions (%d) on the old cluster",
1862 FILE *script = NULL;
1864 prep_status(
"Checking for valid logical replication slots");
1866 snprintf(output_path,
sizeof(output_path),
"%s/%s",
1868 "invalid_logical_slots.txt");
1874 for (
int slotnum = 0; slotnum < slot_arr->
nslots; slotnum++)
1881 if (script == NULL &&
1882 (script =
fopen_priv(output_path,
"w")) == NULL)
1883 pg_fatal(
"could not open file \"%s\": %m", output_path);
1885 fprintf(script,
"The slot \"%s\" is invalid\n",
1900 if (script == NULL &&
1901 (script =
fopen_priv(output_path,
"w")) == NULL)
1902 pg_fatal(
"could not open file \"%s\": %m", output_path);
1905 "The slot \"%s\" has not consumed the WAL yet\n",
1916 pg_fatal(
"Your installation contains logical replication slots that cannot be upgraded.\n"
1917 "You can remove invalid slots and/or consume the pending WAL for other slots,\n"
1918 "and then restart the upgrade.\n"
1919 "A list of the problematic slots is in the file:\n"
1920 " %s", output_path);
1946 if (report->
file == NULL &&
1948 pg_fatal(
"could not open file \"%s\": %m", report->
path);
1950 for (
int i = 0;
i < ntups;
i++)
1951 fprintf(report->
file,
"The table sync state \"%s\" is not allowed for database:\"%s\" subscription:\"%s\" schema:\"%s\" relation:\"%s\"\n",
1981 "subs_invalid.txt");
1989 "SELECT d.datname, s.subname "
1990 "FROM pg_catalog.pg_subscription s "
1991 "LEFT OUTER JOIN pg_catalog.pg_replication_origin o "
1992 " ON o.roname = 'pg_' || s.oid "
1993 "INNER JOIN pg_catalog.pg_database d "
1994 " ON d.oid = s.subdbid "
1995 "WHERE o.roname IS NULL;");
1997 for (
int i = 0;
i < ntup;
i++)
1999 if (report.
file == NULL &&
2001 pg_fatal(
"could not open file \"%s\": %m", report.
path);
2002 fprintf(report.
file,
"The replication origin is missing for database:\"%s\" subscription:\"%s\"\n",
2037 query =
"SELECT r.srsubstate, s.subname, n.nspname, c.relname "
2038 "FROM pg_catalog.pg_subscription_rel r "
2039 "LEFT JOIN pg_catalog.pg_subscription s"
2040 " ON r.srsubid = s.oid "
2041 "LEFT JOIN pg_catalog.pg_class c"
2042 " ON r.srrelid = c.oid "
2043 "LEFT JOIN pg_catalog.pg_namespace n"
2044 " ON c.relnamespace = n.oid "
2045 "WHERE r.srsubstate NOT IN ('i', 'r') "
2046 "ORDER BY s.subname";
2056 fclose(report.
file);
2058 pg_fatal(
"Your installation contains subscriptions without origin or having relations not in i (initialize) or r (ready) state.\n"
2059 "You can allow the initial sync to finish for all relations and then restart the upgrade.\n"
2060 "A list of the problematic subscriptions is in the file:\n"
2061 " %s", report.
path);
#define AssertVariableIsOfType(varname, typename)
#define Assert(condition)
void check_cluster_versions(void)
static void check_for_tables_with_oids(ClusterInfo *cluster)
static void check_for_pg_role_prefix(ClusterInfo *cluster)
static void process_old_sub_state_check(DbInfo *dbinfo, PGresult *res, void *arg)
static void check_for_data_types_usage(ClusterInfo *cluster)
static void process_incompat_polymorphics(DbInfo *dbinfo, PGresult *res, void *arg)
static DataTypesUsageChecks data_types_usage_checks[]
static void process_with_oids_check(DbInfo *dbinfo, PGresult *res, void *arg)
static void check_new_cluster_logical_replication_slots(void)
static void check_old_cluster_subscription_state(void)
void issue_warnings_and_set_wal_level(void)
static char * fix_path_separator(char *path)
void check_cluster_compatibility(void)
void check_new_cluster(void)
void report_clusters_compatible(void)
static void check_is_install_user(ClusterInfo *cluster)
static void check_new_cluster_subscription_configuration(void)
void create_script_for_old_cluster_deletion(char **deletion_script_file_name)
static void process_user_defined_encoding_conversions(DbInfo *dbinfo, PGresult *res, void *arg)
static void process_data_type_check(DbInfo *dbinfo, PGresult *res, void *arg)
void check_and_dump_old_cluster(void)
static void check_for_isn_and_int8_passing_mismatch(ClusterInfo *cluster)
static void check_new_cluster_is_empty(void)
static void check_old_cluster_for_valid_slots(void)
static void process_isn_and_int8_passing_mismatch(DbInfo *dbinfo, PGresult *res, void *arg)
static void check_for_user_defined_postfix_ops(ClusterInfo *cluster)
void output_completion_banner(char *deletion_script_file_name)
static void check_for_prepared_transactions(ClusterInfo *cluster)
static void check_proper_datallowconn(ClusterInfo *cluster)
static void check_for_new_tablespace_dir(void)
static void check_for_user_defined_encoding_conversions(ClusterInfo *cluster)
static char * data_type_check_query(int checknum)
static void check_for_incompatible_polymorphics(ClusterInfo *cluster)
void output_check_banner(void)
static void process_user_defined_postfix_ops(DbInfo *dbinfo, PGresult *res, void *arg)
void cluster(ParseState *pstate, ClusterStmt *stmt, bool isTopLevel)
void get_control_data(ClusterInfo *cluster)
void check_control_data(ControlData *oldctrl, ControlData *newctrl)
static void PGresult * res
void generate_old_dump(void)
void PQfinish(PGconn *conn)
int PQntuples(const PGresult *res)
char * PQgetvalue(const PGresult *res, int tup_num, int field_num)
int PQfnumber(const PGresult *res, const char *field_name)
void * pg_malloc0(size_t size)
char * pg_strdup(const char *in)
void check_file_clone(void)
void check_hard_link(void)
void check_copy_file_range(void)
void check_loadable_libraries(void)
void get_loadable_libraries(void)
void get_subscription_count(ClusterInfo *cluster)
int count_old_cluster_logical_slots(void)
void get_db_rel_and_slot_infos(ClusterInfo *cluster)
static void check_ok(void)
void pfree(void *pointer)
static struct LogicalRepInfo * dbinfo
static pid_t start_postmaster(void)
void init_tablespaces(void)
bool(* DataTypesUsageVersionCheck)(ClusterInfo *cluster)
UpgradeTask * upgrade_task_create(void)
bool jsonb_9_4_check_applicable(ClusterInfo *cluster)
void upgrade_task_run(const UpgradeTask *task, const ClusterInfo *cluster)
void cleanup_output_dirs(void)
void report_extension_updates(ClusterInfo *cluster)
void void pg_log(eLogType type, const char *fmt,...) pg_attribute_printf(2
@ TRANSFER_MODE_COPY_FILE_RANGE
void upgrade_task_free(UpgradeTask *task)
#define fopen_priv(path, mode)
void(* UpgradeTaskProcessCB)(DbInfo *dbinfo, PGresult *res, void *arg)
PGconn * connectToServer(ClusterInfo *cluster, const char *db_name)
#define GET_MAJOR_VERSION(v)
void stop_postmaster(bool in_atexit)
void prep_status(const char *fmt,...) pg_attribute_printf(1
void old_9_6_invalidate_hash_indexes(ClusterInfo *cluster, bool check_mode)
void upgrade_task_add_step(UpgradeTask *task, const char *query, UpgradeTaskProcessCB process_cb, bool free_result, void *arg)
PGresult * executeQueryOrDie(PGconn *conn, const char *fmt,...) pg_attribute_printf(2
bool path_is_prefix_of_path(const char *path1, const char *path2)
void canonicalize_path(char *path)
size_t strlcpy(char *dst, const char *src, size_t siz)
PQExpBuffer createPQExpBuffer(void)
void initPQExpBuffer(PQExpBuffer str)
void appendPQExpBuffer(PQExpBuffer str, const char *fmt,...)
void destroyPQExpBuffer(PQExpBuffer str)
void appendPQExpBufferChar(PQExpBuffer str, char ch)
void appendPQExpBufferStr(PQExpBuffer str, const char *data)
void termPQExpBuffer(PQExpBuffer str)
char * psprintf(const char *fmt,...)
int max_replication_slots
void appendShellString(PQExpBuffer buf, const char *str)
const char * tablespace_suffix
bool float8_pass_by_value
DataTypesUsageVersionCheck version_hook
const char * report_filename
LogicalSlotInfoArr slot_arr
transferMode transfer_mode
DataTypesUsageChecks * check