summaryrefslogtreecommitdiff
path: root/contrib/pg_upgrade/version_old_8_3.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/pg_upgrade/version_old_8_3.c')
-rw-r--r--contrib/pg_upgrade/version_old_8_3.c34
1 files changed, 26 insertions, 8 deletions
diff --git a/contrib/pg_upgrade/version_old_8_3.c b/contrib/pg_upgrade/version_old_8_3.c
index ffb79adc91a..d3c79f4c05b 100644
--- a/contrib/pg_upgrade/version_old_8_3.c
+++ b/contrib/pg_upgrade/version_old_8_3.c
@@ -368,8 +368,13 @@ old_8_3_rebuild_tsvector_tables(ClusterInfo *cluster, bool check_mode)
pg_log(PG_FATAL, "could not create necessary file: %s\n", output_path);
if (!db_used)
{
- fprintf(script, "\\connect %s\n\n",
- quote_identifier(active_db->db_name));
+ PQExpBufferData connectbuf;
+
+ initPQExpBuffer(&connectbuf);
+ appendPsqlMetaConnect(&connectbuf, active_db->db_name);
+ appendPQExpBufferChar(&connectbuf, '\n');
+ fputs(connectbuf.data, script);
+ termPQExpBuffer(&connectbuf);
db_used = true;
}
@@ -488,8 +493,12 @@ old_8_3_invalidate_hash_gin_indexes(ClusterInfo *cluster, bool check_mode)
pg_log(PG_FATAL, "could not create necessary file: %s\n", output_path);
if (!db_used)
{
- fprintf(script, "\\connect %s\n",
- quote_identifier(active_db->db_name));
+ PQExpBufferData connectbuf;
+
+ initPQExpBuffer(&connectbuf);
+ appendPsqlMetaConnect(&connectbuf, active_db->db_name);
+ fputs(connectbuf.data, script);
+ termPQExpBuffer(&connectbuf);
db_used = true;
}
fprintf(script, "REINDEX INDEX %s.%s;\n",
@@ -613,8 +622,12 @@ old_8_3_invalidate_bpchar_pattern_ops_indexes(ClusterInfo *cluster,
pg_log(PG_FATAL, "could not create necessary file: %s\n", output_path);
if (!db_used)
{
- fprintf(script, "\\connect %s\n",
- quote_identifier(active_db->db_name));
+ PQExpBufferData connectbuf;
+
+ initPQExpBuffer(&connectbuf);
+ appendPsqlMetaConnect(&connectbuf, active_db->db_name);
+ fputs(connectbuf.data, script);
+ termPQExpBuffer(&connectbuf);
db_used = true;
}
fprintf(script, "REINDEX INDEX %s.%s;\n",
@@ -740,8 +753,13 @@ old_8_3_create_sequence_script(ClusterInfo *cluster)
pg_log(PG_FATAL, "could not create necessary file: %s\n", output_path);
if (!db_used)
{
- fprintf(script, "\\connect %s\n\n",
- quote_identifier(active_db->db_name));
+ PQExpBufferData connectbuf;
+
+ initPQExpBuffer(&connectbuf);
+ appendPsqlMetaConnect(&connectbuf, active_db->db_name);
+ appendPQExpBufferChar(&connectbuf, '\n');
+ fputs(connectbuf.data, script);
+ termPQExpBuffer(&connectbuf);
db_used = true;
}