Skip to content

Commit 1c36700

Browse files
committed
Use pg_dump's --quote-all-identifiers option in pg_upgrade.
This helps guard against changes in the set of reserved keywords from one version to another. In theory it should only be an issue if we de-reserve a keyword in a newer release, since that can create the type of problem shown in bug #8128. Back-patch to 9.1 where the --quote-all-identifiers option was added.
1 parent df9d764 commit 1c36700

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

contrib/pg_upgrade/dump.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,34 +22,38 @@ generate_old_dump(void)
2222

2323
/* run new pg_dumpall binary for globals */
2424
exec_prog(UTILITY_LOG_FILE, NULL, true,
25-
"\"%s/pg_dumpall\" %s --schema-only --globals-only --binary-upgrade %s -f %s",
25+
"\"%s/pg_dumpall\" %s --schema-only --globals-only "
26+
"--quote-all-identifiers --binary-upgrade %s -f %s",
2627
new_cluster.bindir, cluster_conn_opts(&old_cluster),
2728
log_opts.verbose ? "--verbose" : "",
2829
GLOBALS_DUMP_FILE);
2930
check_ok();
3031

3132
prep_status("Creating dump of database schemas\n");
3233

33-
/* create per-db dump files */
34+
/* create per-db dump files */
3435
for (dbnum = 0; dbnum < old_cluster.dbarr.ndbs; dbnum++)
3536
{
36-
char sql_file_name[MAXPGPATH], log_file_name[MAXPGPATH];
37-
DbInfo *old_db = &old_cluster.dbarr.dbs[dbnum];
37+
char sql_file_name[MAXPGPATH],
38+
log_file_name[MAXPGPATH];
39+
DbInfo *old_db = &old_cluster.dbarr.dbs[dbnum];
3840

3941
pg_log(PG_STATUS, "%s", old_db->db_name);
4042
snprintf(sql_file_name, sizeof(sql_file_name), DB_DUMP_FILE_MASK, old_db->db_oid);
4143
snprintf(log_file_name, sizeof(log_file_name), DB_DUMP_LOG_FILE_MASK, old_db->db_oid);
4244

4345
parallel_exec_prog(log_file_name, NULL,
44-
"\"%s/pg_dump\" %s --schema-only --binary-upgrade --format=custom %s --file=\"%s\" \"%s\"",
45-
new_cluster.bindir, cluster_conn_opts(&old_cluster),
46-
log_opts.verbose ? "--verbose" : "", sql_file_name, old_db->db_name);
46+
"\"%s/pg_dump\" %s --schema-only --quote-all-identifiers "
47+
"--binary-upgrade --format=custom %s --file=\"%s\" \"%s\"",
48+
new_cluster.bindir, cluster_conn_opts(&old_cluster),
49+
log_opts.verbose ? "--verbose" : "",
50+
sql_file_name, old_db->db_name);
4751
}
4852

4953
/* reap all children */
5054
while (reap_child(true) == true)
5155
;
52-
56+
5357
end_progress_output();
5458
check_ok();
5559
}

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