]> granicus.if.org Git - postgresql/commitdiff
Remove useless trailing spaces in queries in C strings
authorPeter Eisentraut <peter_e@gmx.net>
Fri, 14 Apr 2017 03:47:46 +0000 (23:47 -0400)
committerPeter Eisentraut <peter_e@gmx.net>
Fri, 14 Apr 2017 03:47:46 +0000 (23:47 -0400)
Author: Alexander Law <exclusion@gmail.com>

contrib/oid2name/oid2name.c
src/bin/pg_dump/pg_dump.c
src/bin/pg_rewind/libpq_fetch.c
src/bin/psql/describe.c

index 778e8bad419d507a0e6f098aacbe01258a6126c9..ec93e4b8d0a9498bc58c2aa5855cadaf0ac5d293 100644 (file)
@@ -506,20 +506,20 @@ sql_exec_searchtables(PGconn *conn, struct options * opts)
        /* now build the query */
        todo = psprintf(
                                        "SELECT pg_catalog.pg_relation_filenode(c.oid) as \"Filenode\", relname as \"Table Name\" %s\n"
-                                       "FROM pg_catalog.pg_class c \n"
-               "       LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace \n"
+                                       "FROM pg_catalog.pg_class c\n"
+               "       LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n"
                                        "       LEFT JOIN pg_catalog.pg_database d ON d.datname = pg_catalog.current_database(),\n"
-                                       "       pg_catalog.pg_tablespace t \n"
+                                       "       pg_catalog.pg_tablespace t\n"
                                        "WHERE relkind IN (" CppAsString2(RELKIND_RELATION) ","
                                        CppAsString2(RELKIND_MATVIEW) ","
                                        CppAsString2(RELKIND_INDEX) ","
                                        CppAsString2(RELKIND_SEQUENCE) ","
-                                       CppAsString2(RELKIND_TOASTVALUE) ") AND \n"
+                                       CppAsString2(RELKIND_TOASTVALUE) ") AND\n"
                                        "               t.oid = CASE\n"
                        "                       WHEN reltablespace <> 0 THEN reltablespace\n"
                                        "                       ELSE dattablespace\n"
-                                       "               END AND \n"
-                                       "  (%s) \n"
+                                       "               END AND\n"
+                                       "  (%s)\n"
                                        "ORDER BY relname\n",
                                        opts->extended ? addfields : "",
                                        qualifiers);
index 58566f423f57fe8cd6ebdf28a2e8d4b560385c52..102935446271e49b0a4e19ecbcc2e202aa53590f 100644 (file)
@@ -13984,12 +13984,12 @@ dumpTSConfig(Archive *fout, TSConfigInfo *cfginfo)
 
        resetPQExpBuffer(query);
        appendPQExpBuffer(query,
-                                         "SELECT \n"
-                                         "  ( SELECT alias FROM pg_catalog.ts_token_type('%u'::pg_catalog.oid) AS t \n"
-                                         "    WHERE t.tokid = m.maptokentype ) AS tokenname, \n"
-                                         "  m.mapdict::pg_catalog.regdictionary AS dictname \n"
-                                         "FROM pg_catalog.pg_ts_config_map AS m \n"
-                                         "WHERE m.mapcfg = '%u' \n"
+                                         "SELECT\n"
+                                         "  ( SELECT alias FROM pg_catalog.ts_token_type('%u'::pg_catalog.oid) AS t\n"
+                                         "    WHERE t.tokid = m.maptokentype ) AS tokenname,\n"
+                                         "  m.mapdict::pg_catalog.regdictionary AS dictname\n"
+                                         "FROM pg_catalog.pg_ts_config_map AS m\n"
+                                         "WHERE m.mapcfg = '%u'\n"
                                          "ORDER BY m.mapcfg, m.maptokentype, m.mapseqno",
                                          cfginfo->cfgparser, cfginfo->dobj.catId.oid);
 
index d86ecd3660507a63f47b1acea8e6365ef237d1a3..eb74d2f1078986d422d302e9d165f8089fc438a6 100644 (file)
@@ -489,7 +489,7 @@ libpq_executeFileMap(filemap_t *map)
         * temporary table. Now, actually fetch all of those ranges.
         */
        sql =
-               "SELECT path, begin, \n"
+               "SELECT path, begin,\n"
                "  pg_read_binary_file(path, begin, len, true) AS chunk\n"
                "FROM fetchchunks\n";
 
index 696b1530f8970212f501ede33b0b07a3474b7385..2494d046b25c323bd7d72ee2597c1d2dfcb151e4 100644 (file)
@@ -375,7 +375,7 @@ describeFunctions(const char *functypes, const char *pattern, bool verbose, bool
                                                  "        END ||\n"
                                                  "        CASE\n"
                         "          WHEN COALESCE(p.proargnames[s.i], '') = '' THEN ''\n"
-                                                 "          ELSE p.proargnames[s.i] || ' ' \n"
+                                                 "          ELSE p.proargnames[s.i] || ' '\n"
                                                  "        END ||\n"
                          "        pg_catalog.format_type(p.proallargtypes[s.i], NULL)\n"
                                                  "      FROM\n"
@@ -898,7 +898,7 @@ permissionsList(const char *pattern)
                                                  "    SELECT polname\n"
                                                  "    || CASE WHEN polcmd != '*' THEN\n"
                                                  "           E' (' || polcmd || E'):'\n"
-                                                 "       ELSE E':' \n"
+                                                 "       ELSE E':'\n"
                                                  "       END\n"
                                                  "    || CASE WHEN polqual IS NOT NULL THEN\n"
                                                  "           E'\\n  (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
@@ -932,7 +932,7 @@ permissionsList(const char *pattern)
                                                  "       ELSE '' END\n"
                                                  "    || CASE WHEN polcmd != '*' THEN\n"
                                                  "           E' (' || polcmd || E'):'\n"
-                                                 "       ELSE E':' \n"
+                                                 "       ELSE E':'\n"
                                                  "       END\n"
                                                  "    || CASE WHEN polqual IS NOT NULL THEN\n"
                                                  "           E'\\n  (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
@@ -2255,7 +2255,7 @@ describeOneTableDetails(const char *schemaname,
                                                                  "CASE WHEN pol.polroles = '{0}' THEN NULL ELSE array_to_string(array(select rolname from pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
                                                   "pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
                                          "pg_catalog.pg_get_expr(pol.polwithcheck, pol.polrelid),\n"
-                                                                 "CASE pol.polcmd \n"
+                                                                 "CASE pol.polcmd\n"
                                                                  "WHEN 'r' THEN 'SELECT'\n"
                                                                  "WHEN 'a' THEN 'INSERT'\n"
                                                                  "WHEN 'w' THEN 'UPDATE'\n"
@@ -2270,7 +2270,7 @@ describeOneTableDetails(const char *schemaname,
                                                                  "CASE WHEN pol.polroles = '{0}' THEN NULL ELSE array_to_string(array(select rolname from pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
                                                   "pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
                                          "pg_catalog.pg_get_expr(pol.polwithcheck, pol.polrelid),\n"
-                                                                 "CASE pol.polcmd \n"
+                                                                 "CASE pol.polcmd\n"
                                                                  "WHEN 'r' THEN 'SELECT'\n"
                                                                  "WHEN 'a' THEN 'INSERT'\n"
                                                                  "WHEN 'w' THEN 'UPDATE'\n"
@@ -3975,11 +3975,11 @@ listTSParsers(const char *pattern, bool verbose)
        initPQExpBuffer(&buf);
 
        printfPQExpBuffer(&buf,
-                                         "SELECT \n"
+                                         "SELECT\n"
                                          "  n.nspname as \"%s\",\n"
                                          "  p.prsname as \"%s\",\n"
                        "  pg_catalog.obj_description(p.oid, 'pg_ts_parser') as \"%s\"\n"
-                                         "FROM pg_catalog.pg_ts_parser p \n"
+                                         "FROM pg_catalog.pg_ts_parser p\n"
                   "LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.prsnamespace\n",
                                          gettext_noop("Schema"),
                                          gettext_noop("Name"),
@@ -4020,9 +4020,9 @@ listTSParsersVerbose(const char *pattern)
        initPQExpBuffer(&buf);
 
        printfPQExpBuffer(&buf,
-                                         "SELECT p.oid, \n"
-                                         "  n.nspname, \n"
-                                         "  p.prsname \n"
+                                         "SELECT p.oid,\n"
+                                         "  n.nspname,\n"
+                                         "  p.prsname\n"
                                          "FROM pg_catalog.pg_ts_parser p\n"
                        "LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.prsnamespace\n"
                );
@@ -4087,34 +4087,34 @@ describeOneTSParser(const char *oid, const char *nspname, const char *prsname)
        initPQExpBuffer(&buf);
 
        printfPQExpBuffer(&buf,
-                                         "SELECT '%s' AS \"%s\", \n"
-                                         "   p.prsstart::pg_catalog.regproc AS \"%s\", \n"
-                 "   pg_catalog.obj_description(p.prsstart, 'pg_proc') as \"%s\" \n"
-                                         " FROM pg_catalog.pg_ts_parser p \n"
-                                         " WHERE p.oid = '%s' \n"
-                                         "UNION ALL \n"
-                                         "SELECT '%s', \n"
-                                         "   p.prstoken::pg_catalog.regproc, \n"
-                                       "   pg_catalog.obj_description(p.prstoken, 'pg_proc') \n"
-                                         " FROM pg_catalog.pg_ts_parser p \n"
-                                         " WHERE p.oid = '%s' \n"
-                                         "UNION ALL \n"
-                                         "SELECT '%s', \n"
-                                         "   p.prsend::pg_catalog.regproc, \n"
-                                         "   pg_catalog.obj_description(p.prsend, 'pg_proc') \n"
-                                         " FROM pg_catalog.pg_ts_parser p \n"
-                                         " WHERE p.oid = '%s' \n"
-                                         "UNION ALL \n"
-                                         "SELECT '%s', \n"
-                                         "   p.prsheadline::pg_catalog.regproc, \n"
-                                "   pg_catalog.obj_description(p.prsheadline, 'pg_proc') \n"
-                                         " FROM pg_catalog.pg_ts_parser p \n"
-                                         " WHERE p.oid = '%s' \n"
-                                         "UNION ALL \n"
-                                         "SELECT '%s', \n"
-                                         "   p.prslextype::pg_catalog.regproc, \n"
-                                 "   pg_catalog.obj_description(p.prslextype, 'pg_proc') \n"
-                                         " FROM pg_catalog.pg_ts_parser p \n"
+                                         "SELECT '%s' AS \"%s\",\n"
+                                         "   p.prsstart::pg_catalog.regproc AS \"%s\",\n"
+                 "   pg_catalog.obj_description(p.prsstart, 'pg_proc') as \"%s\"\n"
+                                         " FROM pg_catalog.pg_ts_parser p\n"
+                                         " WHERE p.oid = '%s'\n"
+                                         "UNION ALL\n"
+                                         "SELECT '%s',\n"
+                                         "   p.prstoken::pg_catalog.regproc,\n"
+                                       "   pg_catalog.obj_description(p.prstoken, 'pg_proc')\n"
+                                         " FROM pg_catalog.pg_ts_parser p\n"
+                                         " WHERE p.oid = '%s'\n"
+                                         "UNION ALL\n"
+                                         "SELECT '%s',\n"
+                                         "   p.prsend::pg_catalog.regproc,\n"
+                                         "   pg_catalog.obj_description(p.prsend, 'pg_proc')\n"
+                                         " FROM pg_catalog.pg_ts_parser p\n"
+                                         " WHERE p.oid = '%s'\n"
+                                         "UNION ALL\n"
+                                         "SELECT '%s',\n"
+                                         "   p.prsheadline::pg_catalog.regproc,\n"
+                                "   pg_catalog.obj_description(p.prsheadline, 'pg_proc')\n"
+                                         " FROM pg_catalog.pg_ts_parser p\n"
+                                         " WHERE p.oid = '%s'\n"
+                                         "UNION ALL\n"
+                                         "SELECT '%s',\n"
+                                         "   p.prslextype::pg_catalog.regproc,\n"
+                                 "   pg_catalog.obj_description(p.prslextype, 'pg_proc')\n"
+                                         " FROM pg_catalog.pg_ts_parser p\n"
                                          " WHERE p.oid = '%s';",
                                          gettext_noop("Start parse"),
                                          gettext_noop("Method"),
@@ -4154,9 +4154,9 @@ describeOneTSParser(const char *oid, const char *nspname, const char *prsname)
        initPQExpBuffer(&buf);
 
        printfPQExpBuffer(&buf,
-                                         "SELECT t.alias as \"%s\", \n"
-                                         "  t.description as \"%s\" \n"
-                         "FROM pg_catalog.ts_token_type( '%s'::pg_catalog.oid ) as t \n"
+                                         "SELECT t.alias as \"%s\",\n"
+                                         "  t.description as \"%s\"\n"
+                         "FROM pg_catalog.ts_token_type( '%s'::pg_catalog.oid ) as t\n"
                                          "ORDER BY 1;",
                                          gettext_noop("Token name"),
                                          gettext_noop("Description"),
@@ -4210,7 +4210,7 @@ listTSDictionaries(const char *pattern, bool verbose)
        initPQExpBuffer(&buf);
 
        printfPQExpBuffer(&buf,
-                                         "SELECT \n"
+                                         "SELECT\n"
                                          "  n.nspname as \"%s\",\n"
                                          "  d.dictname as \"%s\",\n",
                                          gettext_noop("Schema"),
@@ -4219,11 +4219,11 @@ listTSDictionaries(const char *pattern, bool verbose)
        if (verbose)
        {
                appendPQExpBuffer(&buf,
-                                                 "  ( SELECT COALESCE(nt.nspname, '(null)')::pg_catalog.text || '.' || t.tmplname FROM \n"
-                                                 "    pg_catalog.pg_ts_template t \n"
-                                                 "    LEFT JOIN pg_catalog.pg_namespace nt ON nt.oid = t.tmplnamespace \n"
-                                                 "    WHERE d.dicttemplate = t.oid ) AS  \"%s\", \n"
-                                                 "  d.dictinitoption as \"%s\", \n",
+                                                 "  ( SELECT COALESCE(nt.nspname, '(null)')::pg_catalog.text || '.' || t.tmplname FROM\n"
+                                                 "    pg_catalog.pg_ts_template t\n"
+                                                 "    LEFT JOIN pg_catalog.pg_namespace nt ON nt.oid = t.tmplnamespace\n"
+                                                 "    WHERE d.dicttemplate = t.oid ) AS  \"%s\",\n"
+                                                 "  d.dictinitoption as \"%s\",\n",
                                                  gettext_noop("Template"),
                                                  gettext_noop("Init options"));
        }
@@ -4282,7 +4282,7 @@ listTSTemplates(const char *pattern, bool verbose)
 
        if (verbose)
                printfPQExpBuffer(&buf,
-                                                 "SELECT \n"
+                                                 "SELECT\n"
                                                  "  n.nspname AS \"%s\",\n"
                                                  "  t.tmplname AS \"%s\",\n"
                                                  "  t.tmplinit::pg_catalog.regproc AS \"%s\",\n"
@@ -4295,7 +4295,7 @@ listTSTemplates(const char *pattern, bool verbose)
                                                  gettext_noop("Description"));
        else
                printfPQExpBuffer(&buf,
-                                                 "SELECT \n"
+                                                 "SELECT\n"
                                                  "  n.nspname AS \"%s\",\n"
                                                  "  t.tmplname AS \"%s\",\n"
                 "  pg_catalog.obj_description(t.oid, 'pg_ts_template') AS \"%s\"\n",
@@ -4355,12 +4355,12 @@ listTSConfigs(const char *pattern, bool verbose)
        initPQExpBuffer(&buf);
 
        printfPQExpBuffer(&buf,
-                                         "SELECT \n"
+                                         "SELECT\n"
                                          "   n.nspname as \"%s\",\n"
                                          "   c.cfgname as \"%s\",\n"
                   "   pg_catalog.obj_description(c.oid, 'pg_ts_config') as \"%s\"\n"
                                          "FROM pg_catalog.pg_ts_config c\n"
-                 "LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.cfgnamespace \n",
+                 "LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.cfgnamespace\n",
                                          gettext_noop("Schema"),
                                          gettext_noop("Name"),
                                          gettext_noop("Description")
@@ -4398,13 +4398,13 @@ listTSConfigsVerbose(const char *pattern)
 
        printfPQExpBuffer(&buf,
                                          "SELECT c.oid, c.cfgname,\n"
-                                         "   n.nspname, \n"
-                                         "   p.prsname, \n"
-                                         "   np.nspname as pnspname \n"
-                                         "FROM pg_catalog.pg_ts_config c \n"
-          "   LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.cfgnamespace, \n"
-                                         " pg_catalog.pg_ts_parser p \n"
-         "   LEFT JOIN pg_catalog.pg_namespace np ON np.oid = p.prsnamespace \n"
+                                         "   n.nspname,\n"
+                                         "   p.prsname,\n"
+                                         "   np.nspname as pnspname\n"
+                                         "FROM pg_catalog.pg_ts_config c\n"
+          "   LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.cfgnamespace,\n"
+                                         " pg_catalog.pg_ts_parser p\n"
+         "   LEFT JOIN pg_catalog.pg_namespace np ON np.oid = p.prsnamespace\n"
                                          "WHERE  p.oid = c.cfgparser\n"
                );
 
@@ -4473,20 +4473,20 @@ describeOneTSConfig(const char *oid, const char *nspname, const char *cfgname,
        initPQExpBuffer(&buf);
 
        printfPQExpBuffer(&buf,
-                                         "SELECT \n"
-                                         "  ( SELECT t.alias FROM \n"
-                                         "    pg_catalog.ts_token_type(c.cfgparser) AS t \n"
-                                         "    WHERE t.tokid = m.maptokentype ) AS \"%s\", \n"
-                                         "  pg_catalog.btrim( \n"
-                                 "    ARRAY( SELECT mm.mapdict::pg_catalog.regdictionary \n"
-                                         "           FROM pg_catalog.pg_ts_config_map AS mm \n"
-                                         "           WHERE mm.mapcfg = m.mapcfg AND mm.maptokentype = m.maptokentype \n"
-                                         "           ORDER BY mapcfg, maptokentype, mapseqno \n"
-                                         "    ) :: pg_catalog.text , \n"
-                                         "  '{}') AS \"%s\" \n"
-        "FROM pg_catalog.pg_ts_config AS c, pg_catalog.pg_ts_config_map AS m \n"
-                                         "WHERE c.oid = '%s' AND m.mapcfg = c.oid \n"
-                                         "GROUP BY m.mapcfg, m.maptokentype, c.cfgparser \n"
+                                         "SELECT\n"
+                                         "  ( SELECT t.alias FROM\n"
+                                         "    pg_catalog.ts_token_type(c.cfgparser) AS t\n"
+                                         "    WHERE t.tokid = m.maptokentype ) AS \"%s\",\n"
+                                         "  pg_catalog.btrim(\n"
+                                 "    ARRAY( SELECT mm.mapdict::pg_catalog.regdictionary\n"
+                                         "           FROM pg_catalog.pg_ts_config_map AS mm\n"
+                                         "           WHERE mm.mapcfg = m.mapcfg AND mm.maptokentype = m.maptokentype\n"
+                                         "           ORDER BY mapcfg, maptokentype, mapseqno\n"
+                                         "    ) :: pg_catalog.text,\n"
+                                         "  '{}') AS \"%s\"\n"
+        "FROM pg_catalog.pg_ts_config AS c, pg_catalog.pg_ts_config_map AS m\n"
+                                         "WHERE c.oid = '%s' AND m.mapcfg = c.oid\n"
+                                         "GROUP BY m.mapcfg, m.maptokentype, c.cfgparser\n"
                                          "ORDER BY 1;",
                                          gettext_noop("Token"),
                                          gettext_noop("Dictionaries"),