Commit 0c22327f authored by Peter Eisentraut's avatar Peter Eisentraut

Remove useless trailing spaces in queries in C strings

Author: Alexander Law <exclusion@gmail.com>
parent 674677c7
...@@ -506,20 +506,20 @@ sql_exec_searchtables(PGconn *conn, struct options * opts) ...@@ -506,20 +506,20 @@ sql_exec_searchtables(PGconn *conn, struct options * opts)
/* now build the query */ /* now build the query */
todo = psprintf( todo = psprintf(
"SELECT pg_catalog.pg_relation_filenode(c.oid) as \"Filenode\", relname as \"Table Name\" %s\n" "SELECT pg_catalog.pg_relation_filenode(c.oid) as \"Filenode\", relname as \"Table Name\" %s\n"
"FROM pg_catalog.pg_class c \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_namespace n ON n.oid = c.relnamespace\n"
" LEFT JOIN pg_catalog.pg_database d ON d.datname = pg_catalog.current_database(),\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) "," "WHERE relkind IN (" CppAsString2(RELKIND_RELATION) ","
CppAsString2(RELKIND_MATVIEW) "," CppAsString2(RELKIND_MATVIEW) ","
CppAsString2(RELKIND_INDEX) "," CppAsString2(RELKIND_INDEX) ","
CppAsString2(RELKIND_SEQUENCE) "," CppAsString2(RELKIND_SEQUENCE) ","
CppAsString2(RELKIND_TOASTVALUE) ") AND \n" CppAsString2(RELKIND_TOASTVALUE) ") AND\n"
" t.oid = CASE\n" " t.oid = CASE\n"
" WHEN reltablespace <> 0 THEN reltablespace\n" " WHEN reltablespace <> 0 THEN reltablespace\n"
" ELSE dattablespace\n" " ELSE dattablespace\n"
" END AND \n" " END AND\n"
" (%s) \n" " (%s)\n"
"ORDER BY relname\n", "ORDER BY relname\n",
opts->extended ? addfields : "", opts->extended ? addfields : "",
qualifiers); qualifiers);
......
...@@ -13984,12 +13984,12 @@ dumpTSConfig(Archive *fout, TSConfigInfo *cfginfo) ...@@ -13984,12 +13984,12 @@ dumpTSConfig(Archive *fout, TSConfigInfo *cfginfo)
resetPQExpBuffer(query); resetPQExpBuffer(query);
appendPQExpBuffer(query, appendPQExpBuffer(query,
"SELECT \n" "SELECT\n"
" ( SELECT alias FROM pg_catalog.ts_token_type('%u'::pg_catalog.oid) AS t \n" " ( SELECT alias FROM pg_catalog.ts_token_type('%u'::pg_catalog.oid) AS t\n"
" WHERE t.tokid = m.maptokentype ) AS tokenname, \n" " WHERE t.tokid = m.maptokentype ) AS tokenname,\n"
" m.mapdict::pg_catalog.regdictionary AS dictname \n" " m.mapdict::pg_catalog.regdictionary AS dictname\n"
"FROM pg_catalog.pg_ts_config_map AS m \n" "FROM pg_catalog.pg_ts_config_map AS m\n"
"WHERE m.mapcfg = '%u' \n" "WHERE m.mapcfg = '%u'\n"
"ORDER BY m.mapcfg, m.maptokentype, m.mapseqno", "ORDER BY m.mapcfg, m.maptokentype, m.mapseqno",
cfginfo->cfgparser, cfginfo->dobj.catId.oid); cfginfo->cfgparser, cfginfo->dobj.catId.oid);
......
...@@ -489,7 +489,7 @@ libpq_executeFileMap(filemap_t *map) ...@@ -489,7 +489,7 @@ libpq_executeFileMap(filemap_t *map)
* temporary table. Now, actually fetch all of those ranges. * temporary table. Now, actually fetch all of those ranges.
*/ */
sql = sql =
"SELECT path, begin, \n" "SELECT path, begin,\n"
" pg_read_binary_file(path, begin, len, true) AS chunk\n" " pg_read_binary_file(path, begin, len, true) AS chunk\n"
"FROM fetchchunks\n"; "FROM fetchchunks\n";
......
...@@ -375,7 +375,7 @@ describeFunctions(const char *functypes, const char *pattern, bool verbose, bool ...@@ -375,7 +375,7 @@ describeFunctions(const char *functypes, const char *pattern, bool verbose, bool
" END ||\n" " END ||\n"
" CASE\n" " CASE\n"
" WHEN COALESCE(p.proargnames[s.i], '') = '' THEN ''\n" " WHEN COALESCE(p.proargnames[s.i], '') = '' THEN ''\n"
" ELSE p.proargnames[s.i] || ' ' \n" " ELSE p.proargnames[s.i] || ' '\n"
" END ||\n" " END ||\n"
" pg_catalog.format_type(p.proallargtypes[s.i], NULL)\n" " pg_catalog.format_type(p.proallargtypes[s.i], NULL)\n"
" FROM\n" " FROM\n"
...@@ -898,7 +898,7 @@ permissionsList(const char *pattern) ...@@ -898,7 +898,7 @@ permissionsList(const char *pattern)
" SELECT polname\n" " SELECT polname\n"
" || CASE WHEN polcmd != '*' THEN\n" " || CASE WHEN polcmd != '*' THEN\n"
" E' (' || polcmd || E'):'\n" " E' (' || polcmd || E'):'\n"
" ELSE E':' \n" " ELSE E':'\n"
" END\n" " END\n"
" || CASE WHEN polqual IS NOT NULL THEN\n" " || CASE WHEN polqual IS NOT NULL THEN\n"
" E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n" " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
...@@ -932,7 +932,7 @@ permissionsList(const char *pattern) ...@@ -932,7 +932,7 @@ permissionsList(const char *pattern)
" ELSE '' END\n" " ELSE '' END\n"
" || CASE WHEN polcmd != '*' THEN\n" " || CASE WHEN polcmd != '*' THEN\n"
" E' (' || polcmd || E'):'\n" " E' (' || polcmd || E'):'\n"
" ELSE E':' \n" " ELSE E':'\n"
" END\n" " END\n"
" || CASE WHEN polqual IS NOT NULL THEN\n" " || CASE WHEN polqual IS NOT NULL THEN\n"
" E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n" " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
...@@ -2255,7 +2255,7 @@ describeOneTableDetails(const char *schemaname, ...@@ -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" "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.polqual, pol.polrelid),\n"
"pg_catalog.pg_get_expr(pol.polwithcheck, 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 'r' THEN 'SELECT'\n"
"WHEN 'a' THEN 'INSERT'\n" "WHEN 'a' THEN 'INSERT'\n"
"WHEN 'w' THEN 'UPDATE'\n" "WHEN 'w' THEN 'UPDATE'\n"
...@@ -2270,7 +2270,7 @@ describeOneTableDetails(const char *schemaname, ...@@ -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" "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.polqual, pol.polrelid),\n"
"pg_catalog.pg_get_expr(pol.polwithcheck, 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 'r' THEN 'SELECT'\n"
"WHEN 'a' THEN 'INSERT'\n" "WHEN 'a' THEN 'INSERT'\n"
"WHEN 'w' THEN 'UPDATE'\n" "WHEN 'w' THEN 'UPDATE'\n"
...@@ -3975,11 +3975,11 @@ listTSParsers(const char *pattern, bool verbose) ...@@ -3975,11 +3975,11 @@ listTSParsers(const char *pattern, bool verbose)
initPQExpBuffer(&buf); initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, printfPQExpBuffer(&buf,
"SELECT \n" "SELECT\n"
" n.nspname as \"%s\",\n" " n.nspname as \"%s\",\n"
" p.prsname as \"%s\",\n" " p.prsname as \"%s\",\n"
" pg_catalog.obj_description(p.oid, 'pg_ts_parser') 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", "LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.prsnamespace\n",
gettext_noop("Schema"), gettext_noop("Schema"),
gettext_noop("Name"), gettext_noop("Name"),
...@@ -4020,9 +4020,9 @@ listTSParsersVerbose(const char *pattern) ...@@ -4020,9 +4020,9 @@ listTSParsersVerbose(const char *pattern)
initPQExpBuffer(&buf); initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, printfPQExpBuffer(&buf,
"SELECT p.oid, \n" "SELECT p.oid,\n"
" n.nspname, \n" " n.nspname,\n"
" p.prsname \n" " p.prsname\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" "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) ...@@ -4087,34 +4087,34 @@ describeOneTSParser(const char *oid, const char *nspname, const char *prsname)
initPQExpBuffer(&buf); initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, printfPQExpBuffer(&buf,
"SELECT '%s' AS \"%s\", \n" "SELECT '%s' AS \"%s\",\n"
" p.prsstart::pg_catalog.regproc AS \"%s\", \n" " p.prsstart::pg_catalog.regproc AS \"%s\",\n"
" pg_catalog.obj_description(p.prsstart, 'pg_proc') as \"%s\" \n" " pg_catalog.obj_description(p.prsstart, 'pg_proc') as \"%s\"\n"
" FROM pg_catalog.pg_ts_parser p \n" " FROM pg_catalog.pg_ts_parser p\n"
" WHERE p.oid = '%s' \n" " WHERE p.oid = '%s'\n"
"UNION ALL \n" "UNION ALL\n"
"SELECT '%s', \n" "SELECT '%s',\n"
" p.prstoken::pg_catalog.regproc, \n" " p.prstoken::pg_catalog.regproc,\n"
" pg_catalog.obj_description(p.prstoken, 'pg_proc') \n" " pg_catalog.obj_description(p.prstoken, 'pg_proc')\n"
" FROM pg_catalog.pg_ts_parser p \n" " FROM pg_catalog.pg_ts_parser p\n"
" WHERE p.oid = '%s' \n" " WHERE p.oid = '%s'\n"
"UNION ALL \n" "UNION ALL\n"
"SELECT '%s', \n" "SELECT '%s',\n"
" p.prsend::pg_catalog.regproc, \n" " p.prsend::pg_catalog.regproc,\n"
" pg_catalog.obj_description(p.prsend, 'pg_proc') \n" " pg_catalog.obj_description(p.prsend, 'pg_proc')\n"
" FROM pg_catalog.pg_ts_parser p \n" " FROM pg_catalog.pg_ts_parser p\n"
" WHERE p.oid = '%s' \n" " WHERE p.oid = '%s'\n"
"UNION ALL \n" "UNION ALL\n"
"SELECT '%s', \n" "SELECT '%s',\n"
" p.prsheadline::pg_catalog.regproc, \n" " p.prsheadline::pg_catalog.regproc,\n"
" pg_catalog.obj_description(p.prsheadline, 'pg_proc') \n" " pg_catalog.obj_description(p.prsheadline, 'pg_proc')\n"
" FROM pg_catalog.pg_ts_parser p \n" " FROM pg_catalog.pg_ts_parser p\n"
" WHERE p.oid = '%s' \n" " WHERE p.oid = '%s'\n"
"UNION ALL \n" "UNION ALL\n"
"SELECT '%s', \n" "SELECT '%s',\n"
" p.prslextype::pg_catalog.regproc, \n" " p.prslextype::pg_catalog.regproc,\n"
" pg_catalog.obj_description(p.prslextype, 'pg_proc') \n" " pg_catalog.obj_description(p.prslextype, 'pg_proc')\n"
" FROM pg_catalog.pg_ts_parser p \n" " FROM pg_catalog.pg_ts_parser p\n"
" WHERE p.oid = '%s';", " WHERE p.oid = '%s';",
gettext_noop("Start parse"), gettext_noop("Start parse"),
gettext_noop("Method"), gettext_noop("Method"),
...@@ -4154,9 +4154,9 @@ describeOneTSParser(const char *oid, const char *nspname, const char *prsname) ...@@ -4154,9 +4154,9 @@ describeOneTSParser(const char *oid, const char *nspname, const char *prsname)
initPQExpBuffer(&buf); initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, printfPQExpBuffer(&buf,
"SELECT t.alias as \"%s\", \n" "SELECT t.alias as \"%s\",\n"
" t.description as \"%s\" \n" " t.description as \"%s\"\n"
"FROM pg_catalog.ts_token_type( '%s'::pg_catalog.oid ) as t \n" "FROM pg_catalog.ts_token_type( '%s'::pg_catalog.oid ) as t\n"
"ORDER BY 1;", "ORDER BY 1;",
gettext_noop("Token name"), gettext_noop("Token name"),
gettext_noop("Description"), gettext_noop("Description"),
...@@ -4210,7 +4210,7 @@ listTSDictionaries(const char *pattern, bool verbose) ...@@ -4210,7 +4210,7 @@ listTSDictionaries(const char *pattern, bool verbose)
initPQExpBuffer(&buf); initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, printfPQExpBuffer(&buf,
"SELECT \n" "SELECT\n"
" n.nspname as \"%s\",\n" " n.nspname as \"%s\",\n"
" d.dictname as \"%s\",\n", " d.dictname as \"%s\",\n",
gettext_noop("Schema"), gettext_noop("Schema"),
...@@ -4219,11 +4219,11 @@ listTSDictionaries(const char *pattern, bool verbose) ...@@ -4219,11 +4219,11 @@ listTSDictionaries(const char *pattern, bool verbose)
if (verbose) if (verbose)
{ {
appendPQExpBuffer(&buf, appendPQExpBuffer(&buf,
" ( SELECT COALESCE(nt.nspname, '(null)')::pg_catalog.text || '.' || t.tmplname FROM \n" " ( SELECT COALESCE(nt.nspname, '(null)')::pg_catalog.text || '.' || t.tmplname FROM\n"
" pg_catalog.pg_ts_template t \n" " pg_catalog.pg_ts_template t\n"
" LEFT JOIN pg_catalog.pg_namespace nt ON nt.oid = t.tmplnamespace \n" " LEFT JOIN pg_catalog.pg_namespace nt ON nt.oid = t.tmplnamespace\n"
" WHERE d.dicttemplate = t.oid ) AS \"%s\", \n" " WHERE d.dicttemplate = t.oid ) AS \"%s\",\n"
" d.dictinitoption as \"%s\", \n", " d.dictinitoption as \"%s\",\n",
gettext_noop("Template"), gettext_noop("Template"),
gettext_noop("Init options")); gettext_noop("Init options"));
} }
...@@ -4282,7 +4282,7 @@ listTSTemplates(const char *pattern, bool verbose) ...@@ -4282,7 +4282,7 @@ listTSTemplates(const char *pattern, bool verbose)
if (verbose) if (verbose)
printfPQExpBuffer(&buf, printfPQExpBuffer(&buf,
"SELECT \n" "SELECT\n"
" n.nspname AS \"%s\",\n" " n.nspname AS \"%s\",\n"
" t.tmplname AS \"%s\",\n" " t.tmplname AS \"%s\",\n"
" t.tmplinit::pg_catalog.regproc AS \"%s\",\n" " t.tmplinit::pg_catalog.regproc AS \"%s\",\n"
...@@ -4295,7 +4295,7 @@ listTSTemplates(const char *pattern, bool verbose) ...@@ -4295,7 +4295,7 @@ listTSTemplates(const char *pattern, bool verbose)
gettext_noop("Description")); gettext_noop("Description"));
else else
printfPQExpBuffer(&buf, printfPQExpBuffer(&buf,
"SELECT \n" "SELECT\n"
" n.nspname AS \"%s\",\n" " n.nspname AS \"%s\",\n"
" t.tmplname AS \"%s\",\n" " t.tmplname AS \"%s\",\n"
" pg_catalog.obj_description(t.oid, 'pg_ts_template') 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) ...@@ -4355,12 +4355,12 @@ listTSConfigs(const char *pattern, bool verbose)
initPQExpBuffer(&buf); initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, printfPQExpBuffer(&buf,
"SELECT \n" "SELECT\n"
" n.nspname as \"%s\",\n" " n.nspname as \"%s\",\n"
" c.cfgname as \"%s\",\n" " c.cfgname as \"%s\",\n"
" pg_catalog.obj_description(c.oid, 'pg_ts_config') as \"%s\"\n" " pg_catalog.obj_description(c.oid, 'pg_ts_config') as \"%s\"\n"
"FROM pg_catalog.pg_ts_config c\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("Schema"),
gettext_noop("Name"), gettext_noop("Name"),
gettext_noop("Description") gettext_noop("Description")
...@@ -4398,13 +4398,13 @@ listTSConfigsVerbose(const char *pattern) ...@@ -4398,13 +4398,13 @@ listTSConfigsVerbose(const char *pattern)
printfPQExpBuffer(&buf, printfPQExpBuffer(&buf,
"SELECT c.oid, c.cfgname,\n" "SELECT c.oid, c.cfgname,\n"
" n.nspname, \n" " n.nspname,\n"
" p.prsname, \n" " p.prsname,\n"
" np.nspname as pnspname \n" " np.nspname as pnspname\n"
"FROM pg_catalog.pg_ts_config c \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"
" pg_catalog.pg_ts_parser p \n" " pg_catalog.pg_ts_parser p\n"
" LEFT JOIN pg_catalog.pg_namespace np ON np.oid = p.prsnamespace \n" " LEFT JOIN pg_catalog.pg_namespace np ON np.oid = p.prsnamespace\n"
"WHERE p.oid = c.cfgparser\n" "WHERE p.oid = c.cfgparser\n"
); );
...@@ -4473,20 +4473,20 @@ describeOneTSConfig(const char *oid, const char *nspname, const char *cfgname, ...@@ -4473,20 +4473,20 @@ describeOneTSConfig(const char *oid, const char *nspname, const char *cfgname,
initPQExpBuffer(&buf); initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, printfPQExpBuffer(&buf,
"SELECT \n" "SELECT\n"
" ( SELECT t.alias FROM \n" " ( SELECT t.alias FROM\n"
" pg_catalog.ts_token_type(c.cfgparser) AS t \n" " pg_catalog.ts_token_type(c.cfgparser) AS t\n"
" WHERE t.tokid = m.maptokentype ) AS \"%s\", \n" " WHERE t.tokid = m.maptokentype ) AS \"%s\",\n"
" pg_catalog.btrim( \n" " pg_catalog.btrim(\n"
" ARRAY( SELECT mm.mapdict::pg_catalog.regdictionary \n" " ARRAY( SELECT mm.mapdict::pg_catalog.regdictionary\n"
" FROM pg_catalog.pg_ts_config_map AS mm \n" " FROM pg_catalog.pg_ts_config_map AS mm\n"
" WHERE mm.mapcfg = m.mapcfg AND mm.maptokentype = m.maptokentype \n" " WHERE mm.mapcfg = m.mapcfg AND mm.maptokentype = m.maptokentype\n"
" ORDER BY mapcfg, maptokentype, mapseqno \n" " ORDER BY mapcfg, maptokentype, mapseqno\n"
" ) :: pg_catalog.text , \n" " ) :: pg_catalog.text,\n"
" '{}') AS \"%s\" \n" " '{}') AS \"%s\"\n"
"FROM pg_catalog.pg_ts_config AS c, pg_catalog.pg_ts_config_map AS m \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" "WHERE c.oid = '%s' AND m.mapcfg = c.oid\n"
"GROUP BY m.mapcfg, m.maptokentype, c.cfgparser \n" "GROUP BY m.mapcfg, m.maptokentype, c.cfgparser\n"
"ORDER BY 1;", "ORDER BY 1;",
gettext_noop("Token"), gettext_noop("Token"),
gettext_noop("Dictionaries"), gettext_noop("Dictionaries"),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment