42 char *output_path =
"reindex_hash.sql";
46 for (dbnum = 0; dbnum <
cluster->dbarr.ndbs; dbnum++)
59 "SELECT n.nspname, c.relname "
60 "FROM pg_catalog.pg_class c, "
61 " pg_catalog.pg_index i, "
62 " pg_catalog.pg_am a, "
63 " pg_catalog.pg_namespace n "
64 "WHERE i.indexrelid = c.oid AND "
65 " c.relam = a.oid AND "
66 " c.relnamespace = n.oid AND "
73 for (rowno = 0; rowno < ntups; rowno++)
78 if (script == NULL && (script =
fopen_priv(output_path,
"w")) == NULL)
79 pg_fatal(
"could not open file \"%s\": %m", output_path);
86 fputs(connectbuf.
data, script);
90 fprintf(script,
"REINDEX INDEX %s.%s;\n",
98 if (!check_mode && db_used)
102 "UPDATE pg_catalog.pg_index i "
103 "SET indisvalid = false "
104 "FROM pg_catalog.pg_class c, "
105 " pg_catalog.pg_am a, "
106 " pg_catalog.pg_namespace n "
107 "WHERE i.indexrelid = c.oid AND "
108 " c.relam = a.oid AND "
109 " c.relnamespace = n.oid AND "
110 " a.amname = 'hash'"));
124 "Your installation contains hash indexes. These indexes have different\n"
125 "internal formats between your old and new clusters, so they must be\n"
126 "reindexed with the REINDEX command. After upgrading, you will be given\n"
127 "REINDEX instructions.");
130 "Your installation contains hash indexes. These indexes have different\n"
131 "internal formats between your old and new clusters, so they must be\n"
132 "reindexed with the REINDEX command. The file\n"
134 "when executed by psql by the database superuser will recreate all invalid\n"
135 "indexes; until then, none of these indexes will be used.",
151 char *output_path =
"update_extensions.sql";
155 for (dbnum = 0; dbnum <
cluster->dbarr.ndbs; dbnum++)
158 bool db_used =
false;
168 "FROM pg_available_extensions "
169 "WHERE installed_version != default_version"
174 for (rowno = 0; rowno < ntups; rowno++)
176 if (script == NULL && (script =
fopen_priv(output_path,
"w")) == NULL)
177 pg_fatal(
"could not open file \"%s\": %m", output_path);
184 fputs(connectbuf.
data, script);
188 fprintf(script,
"ALTER EXTENSION %s UPDATE;\n",
202 "Your installation contains extensions that should be updated\n"
203 "with the ALTER EXTENSION command. The file\n"
205 "when executed by psql by the database superuser will update\n"
bool jsonb_9_4_check_applicable(ClusterInfo *cluster)
void report_extension_updates(ClusterInfo *cluster)
void old_9_6_invalidate_hash_indexes(ClusterInfo *cluster, bool check_mode)
void cluster(ParseState *pstate, ClusterStmt *stmt, bool isTopLevel)
static void PGresult * res
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)
static void check_ok(void)
void void pg_log(eLogType type, const char *fmt,...) pg_attribute_printf(2
#define fopen_priv(path, mode)
PGconn * connectToServer(ClusterInfo *cluster, const char *db_name)
#define GET_MAJOR_VERSION(v)
void prep_status(const char *fmt,...) pg_attribute_printf(1
void report_status(eLogType type, const char *fmt,...) pg_attribute_printf(2
#define JSONB_FORMAT_CHANGE_CAT_VER
PGresult * executeQueryOrDie(PGconn *conn, const char *fmt,...) pg_attribute_printf(2
void initPQExpBuffer(PQExpBuffer str)
void termPQExpBuffer(PQExpBuffer str)
const char * quote_identifier(const char *ident)
void appendPsqlMetaConnect(PQExpBuffer buf, const char *dbname)