pg-foreign-options-formatting.patch
text/x-patch
Filename: pg-foreign-options-formatting.patch
Type: text/x-patch
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: unified
| File | + | − |
|---|---|---|
| src/bin/pg_dump/pg_dump.c | 11 | 11 |
diff --git i/src/bin/pg_dump/pg_dump.c w/src/bin/pg_dump/pg_dump.c index afeae6f..6dd4895 100644 --- i/src/bin/pg_dump/pg_dump.c +++ w/src/bin/pg_dump/pg_dump.c @@ -5671,7 +5671,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables) "SELECT pg_catalog.quote_ident(option_name) || " "' ' || pg_catalog.quote_literal(option_value) " "FROM pg_catalog.pg_options_to_table(attfdwoptions)" - "), ', ') AS attfdwoptions " + "), E',\n ') AS attfdwoptions " "FROM pg_catalog.pg_attribute a LEFT JOIN pg_catalog.pg_type t " "ON a.atttypid = t.oid " "WHERE a.attrelid = '%u'::pg_catalog.oid " @@ -6488,7 +6488,7 @@ getForeignDataWrappers(int *numForeignDataWrappers) "SELECT quote_ident(option_name) || ' ' || " "quote_literal(option_value) " "FROM pg_options_to_table(fdwoptions)" - "), ', ') AS fdwoptions " + "), E',\n ') AS fdwoptions " "FROM pg_foreign_data_wrapper", username_subquery); } @@ -6502,7 +6502,7 @@ getForeignDataWrappers(int *numForeignDataWrappers) "SELECT quote_ident(option_name) || ' ' || " "quote_literal(option_value) " "FROM pg_options_to_table(fdwoptions)" - "), ', ') AS fdwoptions " + "), E',\n ') AS fdwoptions " "FROM pg_foreign_data_wrapper", username_subquery); } @@ -6591,7 +6591,7 @@ getForeignServers(int *numForeignServers) "SELECT quote_ident(option_name) || ' ' || " "quote_literal(option_value) " "FROM pg_options_to_table(srvoptions)" - "), ', ') AS srvoptions " + "), E',\n ') AS srvoptions " "FROM pg_foreign_server", username_subquery); @@ -11484,7 +11484,7 @@ dumpForeignDataWrapper(Archive *fout, FdwInfo *fdwinfo) appendPQExpBuffer(q, " VALIDATOR %s", fdwinfo->fdwvalidator); if (strlen(fdwinfo->fdwoptions) > 0) - appendPQExpBuffer(q, " OPTIONS (%s)", fdwinfo->fdwoptions); + appendPQExpBuffer(q, " OPTIONS (\n %s\n)", fdwinfo->fdwoptions); appendPQExpBuffer(q, ";\n"); @@ -11588,7 +11588,7 @@ dumpForeignServer(Archive *fout, ForeignServerInfo *srvinfo) appendPQExpBuffer(q, "%s", fmtId(fdwname)); if (srvinfo->srvoptions && strlen(srvinfo->srvoptions) > 0) - appendPQExpBuffer(q, " OPTIONS (%s)", srvinfo->srvoptions); + appendPQExpBuffer(q, " OPTIONS (\n %s\n)", srvinfo->srvoptions); appendPQExpBuffer(q, ";\n"); @@ -11679,7 +11679,7 @@ dumpUserMappings(Archive *fout, "SELECT quote_ident(option_name) || ' ' || " "quote_literal(option_value) " "FROM pg_options_to_table(umoptions)" - "), ', ') AS umoptions " + "), E',\n ') AS umoptions " "FROM pg_user_mappings " "WHERE srvid = '%u'", catalogId.oid); @@ -11704,7 +11704,7 @@ dumpUserMappings(Archive *fout, appendPQExpBuffer(q, " SERVER %s", fmtId(servername)); if (umoptions && strlen(umoptions) > 0) - appendPQExpBuffer(q, " OPTIONS (%s)", umoptions); + appendPQExpBuffer(q, " OPTIONS (\n %s\n)", umoptions); appendPQExpBuffer(q, ";\n"); @@ -12337,7 +12337,7 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo) "SELECT pg_catalog.quote_ident(option_name) || " "' ' || pg_catalog.quote_literal(option_value) " "FROM pg_catalog.pg_options_to_table(ftoptions)" - "), ', ') AS ftoptions " + "), E',\n ') AS ftoptions " "FROM pg_catalog.pg_foreign_table ft " "JOIN pg_catalog.pg_foreign_server fs " "ON (fs.oid = ft.ftserver) " @@ -12566,7 +12566,7 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo) /* Dump generic options if any */ if (ftoptions && ftoptions[0]) - appendPQExpBuffer(q, "\nOPTIONS (%s)", ftoptions); + appendPQExpBuffer(q, "\nOPTIONS (\n %s\n)", ftoptions); appendPQExpBuffer(q, ";\n"); @@ -12766,7 +12766,7 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo) fmtId(tbinfo->dobj.name)); appendPQExpBuffer(q, "ALTER COLUMN %s ", fmtId(tbinfo->attnames[j])); - appendPQExpBuffer(q, "OPTIONS (%s);\n", + appendPQExpBuffer(q, "OPTIONS (\n %s\n);\n", tbinfo->attfdwoptions[j]); } }