Skip to content

Commit 7e53515

Browse files
committed
pg_dump: Dump foreign options in prettier format
Dump them using line breaks and indentation instead of everything on one line.
1 parent 15df037 commit 7e53515

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/bin/pg_dump/pg_dump.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5726,7 +5726,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
57265726
"SELECT pg_catalog.quote_ident(option_name) || "
57275727
"' ' || pg_catalog.quote_literal(option_value) "
57285728
"FROM pg_catalog.pg_options_to_table(attfdwoptions)"
5729-
"), ', ') AS attfdwoptions "
5729+
"), E',\n ') AS attfdwoptions "
57305730
"FROM pg_catalog.pg_attribute a LEFT JOIN pg_catalog.pg_type t "
57315731
"ON a.atttypid = t.oid "
57325732
"WHERE a.attrelid = '%u'::pg_catalog.oid "
@@ -6557,7 +6557,7 @@ getForeignDataWrappers(int *numForeignDataWrappers)
65576557
"SELECT quote_ident(option_name) || ' ' || "
65586558
"quote_literal(option_value) "
65596559
"FROM pg_options_to_table(fdwoptions)"
6560-
"), ', ') AS fdwoptions "
6560+
"), E',\n ') AS fdwoptions "
65616561
"FROM pg_foreign_data_wrapper",
65626562
username_subquery);
65636563
}
@@ -6571,7 +6571,7 @@ getForeignDataWrappers(int *numForeignDataWrappers)
65716571
"SELECT quote_ident(option_name) || ' ' || "
65726572
"quote_literal(option_value) "
65736573
"FROM pg_options_to_table(fdwoptions)"
6574-
"), ', ') AS fdwoptions "
6574+
"), E',\n ') AS fdwoptions "
65756575
"FROM pg_foreign_data_wrapper",
65766576
username_subquery);
65776577
}
@@ -6660,7 +6660,7 @@ getForeignServers(int *numForeignServers)
66606660
"SELECT quote_ident(option_name) || ' ' || "
66616661
"quote_literal(option_value) "
66626662
"FROM pg_options_to_table(srvoptions)"
6663-
"), ', ') AS srvoptions "
6663+
"), E',\n ') AS srvoptions "
66646664
"FROM pg_foreign_server",
66656665
username_subquery);
66666666

@@ -11575,7 +11575,7 @@ dumpForeignDataWrapper(Archive *fout, FdwInfo *fdwinfo)
1157511575
appendPQExpBuffer(q, " VALIDATOR %s", fdwinfo->fdwvalidator);
1157611576

1157711577
if (strlen(fdwinfo->fdwoptions) > 0)
11578-
appendPQExpBuffer(q, " OPTIONS (%s)", fdwinfo->fdwoptions);
11578+
appendPQExpBuffer(q, " OPTIONS (\n %s\n)", fdwinfo->fdwoptions);
1157911579

1158011580
appendPQExpBuffer(q, ";\n");
1158111581

@@ -11679,7 +11679,7 @@ dumpForeignServer(Archive *fout, ForeignServerInfo *srvinfo)
1167911679
appendPQExpBuffer(q, "%s", fmtId(fdwname));
1168011680

1168111681
if (srvinfo->srvoptions && strlen(srvinfo->srvoptions) > 0)
11682-
appendPQExpBuffer(q, " OPTIONS (%s)", srvinfo->srvoptions);
11682+
appendPQExpBuffer(q, " OPTIONS (\n %s\n)", srvinfo->srvoptions);
1168311683

1168411684
appendPQExpBuffer(q, ";\n");
1168511685

@@ -11770,7 +11770,7 @@ dumpUserMappings(Archive *fout,
1177011770
"SELECT quote_ident(option_name) || ' ' || "
1177111771
"quote_literal(option_value) "
1177211772
"FROM pg_options_to_table(umoptions)"
11773-
"), ', ') AS umoptions "
11773+
"), E',\n ') AS umoptions "
1177411774
"FROM pg_user_mappings "
1177511775
"WHERE srvid = '%u' "
1177611776
"ORDER BY usename",
@@ -11796,7 +11796,7 @@ dumpUserMappings(Archive *fout,
1179611796
appendPQExpBuffer(q, " SERVER %s", fmtId(servername));
1179711797

1179811798
if (umoptions && strlen(umoptions) > 0)
11799-
appendPQExpBuffer(q, " OPTIONS (%s)", umoptions);
11799+
appendPQExpBuffer(q, " OPTIONS (\n %s\n)", umoptions);
1180011800

1180111801
appendPQExpBuffer(q, ";\n");
1180211802

@@ -12431,7 +12431,7 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo)
1243112431
"SELECT pg_catalog.quote_ident(option_name) || "
1243212432
"' ' || pg_catalog.quote_literal(option_value) "
1243312433
"FROM pg_catalog.pg_options_to_table(ftoptions)"
12434-
"), ', ') AS ftoptions "
12434+
"), E',\n ') AS ftoptions "
1243512435
"FROM pg_catalog.pg_foreign_table ft "
1243612436
"JOIN pg_catalog.pg_foreign_server fs "
1243712437
"ON (fs.oid = ft.ftserver) "
@@ -12660,7 +12660,7 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo)
1266012660

1266112661
/* Dump generic options if any */
1266212662
if (ftoptions && ftoptions[0])
12663-
appendPQExpBuffer(q, "\nOPTIONS (%s)", ftoptions);
12663+
appendPQExpBuffer(q, "\nOPTIONS (\n %s\n)", ftoptions);
1266412664

1266512665
appendPQExpBuffer(q, ";\n");
1266612666

@@ -12860,7 +12860,7 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo)
1286012860
fmtId(tbinfo->dobj.name));
1286112861
appendPQExpBuffer(q, "ALTER COLUMN %s ",
1286212862
fmtId(tbinfo->attnames[j]));
12863-
appendPQExpBuffer(q, "OPTIONS (%s);\n",
12863+
appendPQExpBuffer(q, "OPTIONS (\n %s\n);\n",
1286412864
tbinfo->attfdwoptions[j]);
1286512865
}
1286612866
}

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