From 0c22327f269eb3bec25327b0e620bdca082e4628 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Thu, 13 Apr 2017 23:47:46 -0400 Subject: [PATCH] Remove useless trailing spaces in queries in C strings Author: Alexander Law --- contrib/oid2name/oid2name.c | 12 +-- src/bin/pg_dump/pg_dump.c | 12 +-- src/bin/pg_rewind/libpq_fetch.c | 2 +- src/bin/psql/describe.c | 144 ++++++++++++++++---------------- 4 files changed, 85 insertions(+), 85 deletions(-) diff --git a/contrib/oid2name/oid2name.c b/contrib/oid2name/oid2name.c index 778e8bad41..ec93e4b8d0 100644 --- a/contrib/oid2name/oid2name.c +++ b/contrib/oid2name/oid2name.c @@ -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); diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 58566f423f..1029354462 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -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); diff --git a/src/bin/pg_rewind/libpq_fetch.c b/src/bin/pg_rewind/libpq_fetch.c index d86ecd3660..eb74d2f107 100644 --- a/src/bin/pg_rewind/libpq_fetch.c +++ b/src/bin/pg_rewind/libpq_fetch.c @@ -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"; diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index 696b1530f8..2494d046b2 100644 --- a/src/bin/psql/describe.c +++ b/src/bin/psql/describe.c @@ -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"), -- 2.40.0