summaryrefslogtreecommitdiff
path: root/src/bin/psql/tab-complete.c
diff options
context:
space:
mode:
authorTom Lane2017-06-21 19:35:54 +0000
committerTom Lane2017-06-21 19:35:54 +0000
commit382ceffdf7f620d8f2d50e451b4167d291ae2348 (patch)
treef558251492f2c6f86e3566f7a82f9d00509122c2 /src/bin/psql/tab-complete.c
parentc7b8998ebbf310a156aa38022555a24d98fdbfb4 (diff)
Phase 3 of pgindent updates.
Don't move parenthesized lines to the left, even if that means they flow past the right margin. By default, BSD indent lines up statement continuation lines that are within parentheses so that they start just to the right of the preceding left parenthesis. However, traditionally, if that resulted in the continuation line extending to the right of the desired right margin, then indent would push it left just far enough to not overrun the margin, if it could do so without making the continuation line start to the left of the current statement indent. That makes for a weird mix of indentations unless one has been completely rigid about never violating the 80-column limit. This behavior has been pretty universally panned by Postgres developers. Hence, disable it with indent's new -lpl switch, so that parenthesized lines are always lined up with the preceding left paren. This patch is much less interesting than the first round of indent changes, but also bulkier, so I thought it best to separate the effects. Discussion: https://postgr.es/m/[email protected] Discussion: https://postgr.es/m/[email protected]
Diffstat (limited to 'src/bin/psql/tab-complete.c')
-rw-r--r--src/bin/psql/tab-complete.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 20c41b7ce51..29ccc257932 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -1078,7 +1078,7 @@ static void append_variable_names(char ***varnames, int *nvars,
int *maxvars, const char *varname,
const char *prefix, const char *suffix);
static char **complete_from_variables(const char *text,
- const char *prefix, const char *suffix, bool need_value);
+ const char *prefix, const char *suffix, bool need_value);
static char *complete_from_files(const char *text, int state);
static char *pg_strdup_keyword_case(const char *s, const char *ref);
@@ -1974,11 +1974,11 @@ psql_completion(const char *text, int start, int end)
COMPLETE_WITH_LIST5("(", "DEFAULT", "NOT NULL", "STATISTICS", "STORAGE");
/* ALTER TABLE ALTER [COLUMN] <foo> SET ( */
else if (Matches8("ALTER", "TABLE", MatchAny, "ALTER", "COLUMN", MatchAny, "SET", "(") ||
- Matches7("ALTER", "TABLE", MatchAny, "ALTER", MatchAny, "SET", "("))
+ Matches7("ALTER", "TABLE", MatchAny, "ALTER", MatchAny, "SET", "("))
COMPLETE_WITH_LIST2("n_distinct", "n_distinct_inherited");
/* ALTER TABLE ALTER [COLUMN] <foo> SET STORAGE */
else if (Matches8("ALTER", "TABLE", MatchAny, "ALTER", "COLUMN", MatchAny, "SET", "STORAGE") ||
- Matches7("ALTER", "TABLE", MatchAny, "ALTER", MatchAny, "SET", "STORAGE"))
+ Matches7("ALTER", "TABLE", MatchAny, "ALTER", MatchAny, "SET", "STORAGE"))
COMPLETE_WITH_LIST4("PLAIN", "EXTERNAL", "EXTENDED", "MAIN");
/* ALTER TABLE ALTER [COLUMN] <foo> DROP */
else if (Matches7("ALTER", "TABLE", MatchAny, "ALTER", "COLUMN", MatchAny, "DROP") ||
@@ -2218,7 +2218,7 @@ psql_completion(const char *text, int start, int end)
else if (Matches4("COMMENT", "ON", "EVENT", "TRIGGER"))
COMPLETE_WITH_QUERY(Query_for_list_of_event_triggers);
else if (Matches4("COMMENT", "ON", MatchAny, MatchAnyExcept("IS")) ||
- Matches5("COMMENT", "ON", MatchAny, MatchAny, MatchAnyExcept("IS")) ||
+ Matches5("COMMENT", "ON", MatchAny, MatchAny, MatchAnyExcept("IS")) ||
Matches6("COMMENT", "ON", MatchAny, MatchAny, MatchAny, MatchAnyExcept("IS")))
COMPLETE_WITH_CONST("IS");
@@ -2474,7 +2474,7 @@ psql_completion(const char *text, int start, int end)
COMPLETE_WITH_LIST8("INCREMENT BY", "MINVALUE", "MAXVALUE", "NO", "CACHE",
"CYCLE", "OWNED BY", "START WITH");
else if (TailMatches4("CREATE", "SEQUENCE", MatchAny, "NO") ||
- TailMatches5("CREATE", "TEMP|TEMPORARY", "SEQUENCE", MatchAny, "NO"))
+ TailMatches5("CREATE", "TEMP|TEMPORARY", "SEQUENCE", MatchAny, "NO"))
COMPLETE_WITH_LIST3("MINVALUE", "MAXVALUE", "CYCLE");
/* CREATE SERVER <name> */
@@ -2553,7 +2553,7 @@ psql_completion(const char *text, int start, int end)
COMPLETE_WITH_LIST3("INSERT", "DELETE", "UPDATE");
/* complete CREATE TRIGGER <name> BEFORE,AFTER sth with OR,ON */
else if (TailMatches5("CREATE", "TRIGGER", MatchAny, "BEFORE|AFTER", MatchAny) ||
- TailMatches6("CREATE", "TRIGGER", MatchAny, "INSTEAD", "OF", MatchAny))
+ TailMatches6("CREATE", "TRIGGER", MatchAny, "INSTEAD", "OF", MatchAny))
COMPLETE_WITH_LIST2("ON", "OR");
/*
@@ -2567,7 +2567,7 @@ psql_completion(const char *text, int start, int end)
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_views, NULL);
else if (HeadMatches2("CREATE", "TRIGGER") && TailMatches2("ON", MatchAny))
COMPLETE_WITH_LIST7("NOT DEFERRABLE", "DEFERRABLE", "INITIALLY",
- "REFERENCING", "FOR", "WHEN (", "EXECUTE PROCEDURE");
+ "REFERENCING", "FOR", "WHEN (", "EXECUTE PROCEDURE");
else if (HeadMatches2("CREATE", "TRIGGER") &&
(TailMatches1("DEFERRABLE") || TailMatches2("INITIALLY", "IMMEDIATE|DEFERRED")))
COMPLETE_WITH_LIST4("REFERENCING", "FOR", "WHEN (", "EXECUTE PROCEDURE");
@@ -2859,7 +2859,7 @@ psql_completion(const char *text, int start, int end)
*/
if (HeadMatches3("ALTER", "DEFAULT", "PRIVILEGES"))
COMPLETE_WITH_LIST10("SELECT", "INSERT", "UPDATE",
- "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER",
+ "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER",
"EXECUTE", "USAGE", "ALL");
else
COMPLETE_WITH_QUERY(Query_for_list_of_roles
@@ -2913,8 +2913,8 @@ psql_completion(const char *text, int start, int end)
COMPLETE_WITH_LIST5("TABLES", "SEQUENCES", "FUNCTIONS", "TYPES", "SCHEMAS");
else
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tsvmf,
- " UNION SELECT 'ALL FUNCTIONS IN SCHEMA'"
- " UNION SELECT 'ALL SEQUENCES IN SCHEMA'"
+ " UNION SELECT 'ALL FUNCTIONS IN SCHEMA'"
+ " UNION SELECT 'ALL SEQUENCES IN SCHEMA'"
" UNION SELECT 'ALL TABLES IN SCHEMA'"
" UNION SELECT 'DATABASE'"
" UNION SELECT 'DOMAIN'"
@@ -3203,11 +3203,11 @@ psql_completion(const char *text, int start, int end)
else if (Matches2("BEGIN|START", "TRANSACTION") ||
Matches2("BEGIN", "WORK") ||
Matches1("BEGIN") ||
- Matches5("SET", "SESSION", "CHARACTERISTICS", "AS", "TRANSACTION"))
+ Matches5("SET", "SESSION", "CHARACTERISTICS", "AS", "TRANSACTION"))
COMPLETE_WITH_LIST4("ISOLATION LEVEL", "READ", "DEFERRABLE", "NOT DEFERRABLE");
else if (Matches3("SET|BEGIN|START", "TRANSACTION|WORK", "NOT") ||
Matches2("BEGIN", "NOT") ||
- Matches6("SET", "SESSION", "CHARACTERISTICS", "AS", "TRANSACTION", "NOT"))
+ Matches6("SET", "SESSION", "CHARACTERISTICS", "AS", "TRANSACTION", "NOT"))
COMPLETE_WITH_CONST("DEFERRABLE");
else if (Matches3("SET|BEGIN|START", "TRANSACTION|WORK", "ISOLATION") ||
Matches2("BEGIN", "ISOLATION") ||
@@ -3836,7 +3836,7 @@ _complete_from_query(int is_schema_query, const char *text, int state)
{
appendPQExpBufferStr(&query_buffer,
" AND c.relnamespace <> (SELECT oid FROM"
- " pg_catalog.pg_namespace WHERE nspname = 'pg_catalog')");
+ " pg_catalog.pg_namespace WHERE nspname = 'pg_catalog')");
}
/*
@@ -3844,14 +3844,14 @@ _complete_from_query(int is_schema_query, const char *text, int state)
* one potential match among schema names.
*/
appendPQExpBuffer(&query_buffer, "\nUNION\n"
- "SELECT pg_catalog.quote_ident(n.nspname) || '.' "
+ "SELECT pg_catalog.quote_ident(n.nspname) || '.' "
"FROM pg_catalog.pg_namespace n "
"WHERE substring(pg_catalog.quote_ident(n.nspname) || '.',1,%d)='%s'",
char_length, e_text);
appendPQExpBuffer(&query_buffer,
" AND (SELECT pg_catalog.count(*)"
" FROM pg_catalog.pg_namespace"
- " WHERE substring(pg_catalog.quote_ident(nspname) || '.',1,%d) ="
+ " WHERE substring(pg_catalog.quote_ident(nspname) || '.',1,%d) ="
" substring('%s',1,pg_catalog.length(pg_catalog.quote_ident(nspname))+1)) > 1",
char_length, e_text);
@@ -3860,7 +3860,7 @@ _complete_from_query(int is_schema_query, const char *text, int state)
* one schema matching the input-so-far.
*/
appendPQExpBuffer(&query_buffer, "\nUNION\n"
- "SELECT pg_catalog.quote_ident(n.nspname) || '.' || %s "
+ "SELECT pg_catalog.quote_ident(n.nspname) || '.' || %s "
"FROM %s, pg_catalog.pg_namespace n "
"WHERE %s = n.oid AND ",
qualresult,
@@ -3878,13 +3878,13 @@ _complete_from_query(int is_schema_query, const char *text, int state)
* speed up the query
*/
appendPQExpBuffer(&query_buffer,
- " AND substring(pg_catalog.quote_ident(n.nspname) || '.',1,%d) ="
+ " AND substring(pg_catalog.quote_ident(n.nspname) || '.',1,%d) ="
" substring('%s',1,pg_catalog.length(pg_catalog.quote_ident(n.nspname))+1)",
char_length, e_text);
appendPQExpBuffer(&query_buffer,
" AND (SELECT pg_catalog.count(*)"
" FROM pg_catalog.pg_namespace"
- " WHERE substring(pg_catalog.quote_ident(nspname) || '.',1,%d) ="
+ " WHERE substring(pg_catalog.quote_ident(nspname) || '.',1,%d) ="
" substring('%s',1,pg_catalog.length(pg_catalog.quote_ident(nspname))+1)) = 1",
char_length, e_text);
@@ -4152,7 +4152,7 @@ pg_strdup_keyword_case(const char *s, const char *ref)
if (pset.comp_case == PSQL_COMP_CASE_LOWER ||
((pset.comp_case == PSQL_COMP_CASE_PRESERVE_LOWER ||
- pset.comp_case == PSQL_COMP_CASE_PRESERVE_UPPER) && islower(first)) ||
+ pset.comp_case == PSQL_COMP_CASE_PRESERVE_UPPER) && islower(first)) ||
(pset.comp_case == PSQL_COMP_CASE_PRESERVE_LOWER && !isalpha(first)))
{
for (p = ret; *p; p++)