From: Robert Haas Date: Thu, 25 Aug 2011 16:37:32 +0000 (-0400) Subject: Properly quote SQL/MED generic options in pg_dump output. X-Git-Tag: REL9_1_0~52 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=de632180ed51b8a6ff275a5f81198521e8b30e12;p=postgresql Properly quote SQL/MED generic options in pg_dump output. Shigeru Hanada --- diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 9e69b0fc52..ec1ce13e47 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -6369,7 +6369,8 @@ getForeignDataWrappers(int *numForeignDataWrappers) "fdwhandler::pg_catalog.regproc, " "fdwvalidator::pg_catalog.regproc, fdwacl, " "array_to_string(ARRAY(" - " SELECT option_name || ' ' || quote_literal(option_value) " + " SELECT quote_ident(option_name) || ' ' || " + " quote_literal(option_value) " " FROM pg_options_to_table(fdwoptions)), ', ') AS fdwoptions " "FROM pg_foreign_data_wrapper", username_subquery); @@ -6381,7 +6382,8 @@ getForeignDataWrappers(int *numForeignDataWrappers) "'-' AS fdwhandler, " "fdwvalidator::pg_catalog.regproc, fdwacl, " "array_to_string(ARRAY(" - " SELECT option_name || ' ' || quote_literal(option_value) " + " SELECT quote_ident(option_name) || ' ' || " + " quote_literal(option_value) " " FROM pg_options_to_table(fdwoptions)), ', ') AS fdwoptions " "FROM pg_foreign_data_wrapper", username_subquery); @@ -6468,7 +6470,8 @@ getForeignServers(int *numForeignServers) "(%s srvowner) AS rolname, " "srvfdw, srvtype, srvversion, srvacl," "array_to_string(ARRAY(" - " SELECT option_name || ' ' || quote_literal(option_value) " + " SELECT quote_ident(option_name) || ' ' || " + " quote_literal(option_value) " " FROM pg_options_to_table(srvoptions)), ', ') AS srvoptions " "FROM pg_foreign_server", username_subquery); @@ -11395,7 +11398,7 @@ dumpUserMappings(Archive *fout, appendPQExpBuffer(query, "SELECT usename, " - "array_to_string(ARRAY(SELECT option_name || ' ' || quote_literal(option_value) FROM pg_options_to_table(umoptions)), ', ') AS umoptions\n" + "array_to_string(ARRAY(SELECT quote_ident(option_name) || ' ' || quote_literal(option_value) FROM pg_options_to_table(umoptions)), ', ') AS umoptions\n" "FROM pg_user_mappings " "WHERE srvid = %u", catalogId.oid); @@ -12043,7 +12046,8 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo) /* retrieve name of foreign server and generic options */ appendPQExpBuffer(query, "SELECT fs.srvname, array_to_string(ARRAY(" - " SELECT option_name || ' ' || quote_literal(option_value)" + " SELECT quote_ident(option_name) || ' ' || " + " quote_literal(option_value)" " FROM pg_options_to_table(ftoptions)), ', ') AS ftoptions " "FROM pg_foreign_table ft JOIN pg_foreign_server fs " " ON (fs.oid = ft.ftserver) "