1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-12 21:01:52 +03:00

pgindent run for 9.5

This commit is contained in:
Bruce Momjian
2015-05-23 21:35:49 -04:00
parent 225892552b
commit 807b9e0dff
414 changed files with 5810 additions and 5308 deletions

View File

@ -816,10 +816,10 @@ static char *_complete_from_query(int is_schema_query,
static char *complete_from_list(const char *text, int state);
static char *complete_from_const(const char *text, int state);
static void append_variable_names(char ***varnames, int *nvars,
int *maxvars, const char *varname,
const char *prefix, const char *suffix);
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);
@ -961,6 +961,7 @@ psql_completion(const char *text, int start, int end)
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tables,
"UNION SELECT 'ALL IN TABLESPACE'");
}
/*
* complete with what you can alter (TABLE, GROUP, USER, ...) unless we're
* in ALTER TABLE sth ALTER
@ -984,7 +985,7 @@ psql_completion(const char *text, int start, int end)
pg_strcasecmp(prev2_wd, "TABLESPACE") == 0)
{
static const char *const list_ALTERALLINTSPC[] =
{"SET TABLESPACE", "OWNED BY", NULL};
{"SET TABLESPACE", "OWNED BY", NULL};
COMPLETE_WITH_LIST(list_ALTERALLINTSPC);
}
@ -1129,7 +1130,7 @@ psql_completion(const char *text, int start, int end)
{
static const char *const list_ALTER_FOREIGN_TABLE[] =
{"ADD", "ALTER", "DISABLE TRIGGER", "DROP", "ENABLE", "INHERIT",
"NO INHERIT", "OPTIONS", "OWNER TO", "RENAME", "SET",
"NO INHERIT", "OPTIONS", "OWNER TO", "RENAME", "SET",
"VALIDATE CONSTRAINT", NULL};
COMPLETE_WITH_LIST(list_ALTER_FOREIGN_TABLE);
@ -1381,7 +1382,7 @@ psql_completion(const char *text, int start, int end)
else if (pg_strcasecmp(prev3_wd, "ALTER") == 0 &&
pg_strcasecmp(prev2_wd, "SYSTEM") == 0 &&
(pg_strcasecmp(prev_wd, "SET") == 0 ||
pg_strcasecmp(prev_wd, "RESET") == 0))
pg_strcasecmp(prev_wd, "RESET") == 0))
COMPLETE_WITH_QUERY(Query_for_list_of_alter_system_set_vars);
/* ALTER VIEW <name> */
else if (pg_strcasecmp(prev3_wd, "ALTER") == 0 &&
@ -1572,7 +1573,7 @@ psql_completion(const char *text, int start, int end)
pg_strcasecmp(prev_wd, "DISABLE") == 0)
{
static const char *const list_ALTERDISABLE[] =
{ "ROW LEVEL SECURITY", "RULE", "TRIGGER", NULL};
{"ROW LEVEL SECURITY", "RULE", "TRIGGER", NULL};
COMPLETE_WITH_LIST(list_ALTERDISABLE);
}
@ -1598,7 +1599,7 @@ psql_completion(const char *text, int start, int end)
pg_strcasecmp(prev_wd, "SECURITY") == 0)
{
static const char *const list_DISABLERLS[] =
{ "CASCADE", NULL};
{"CASCADE", NULL};
COMPLETE_WITH_LIST(list_DISABLERLS);
}
@ -2140,7 +2141,7 @@ psql_completion(const char *text, int start, int end)
pg_strcasecmp(prev4_wd, "ON") == 0) ||
(pg_strcasecmp(prev6_wd, "COMMENT") == 0 &&
pg_strcasecmp(prev5_wd, "ON") == 0)) &&
pg_strcasecmp(prev_wd, "IS") != 0)
pg_strcasecmp(prev_wd, "IS") != 0)
COMPLETE_WITH_CONST("IS");
/* COPY */
@ -2205,7 +2206,7 @@ psql_completion(const char *text, int start, int end)
{
static const char *const list_DATABASE[] =
{"OWNER", "TEMPLATE", "ENCODING", "TABLESPACE", "IS_TEMPLATE",
"ALLOW_CONNECTIONS", "CONNECTION LIMIT", "LC_COLLATE", "LC_CTYPE",
"ALLOW_CONNECTIONS", "CONNECTION LIMIT", "LC_COLLATE", "LC_CTYPE",
NULL};
COMPLETE_WITH_LIST(list_DATABASE);
@ -2309,8 +2310,8 @@ psql_completion(const char *text, int start, int end)
COMPLETE_WITH_ATTR(prev4_wd, "");
/* Complete USING with an index method */
else if ((pg_strcasecmp(prev6_wd, "INDEX") == 0 ||
pg_strcasecmp(prev5_wd, "INDEX") == 0 ||
pg_strcasecmp(prev4_wd, "INDEX") == 0) &&
pg_strcasecmp(prev5_wd, "INDEX") == 0 ||
pg_strcasecmp(prev4_wd, "INDEX") == 0) &&
pg_strcasecmp(prev3_wd, "ON") == 0 &&
pg_strcasecmp(prev_wd, "USING") == 0)
COMPLETE_WITH_QUERY(Query_for_list_of_access_methods);
@ -2340,7 +2341,11 @@ psql_completion(const char *text, int start, int end)
COMPLETE_WITH_LIST(list_POLICYOPTIONS);
}
/* Complete "CREATE POLICY <name> ON <table> FOR ALL|SELECT|INSERT|UPDATE|DELETE" */
/*
* Complete "CREATE POLICY <name> ON <table> FOR
* ALL|SELECT|INSERT|UPDATE|DELETE"
*/
else if (pg_strcasecmp(prev6_wd, "CREATE") == 0 &&
pg_strcasecmp(prev5_wd, "POLICY") == 0 &&
pg_strcasecmp(prev3_wd, "ON") == 0 &&
@ -2362,30 +2367,33 @@ psql_completion(const char *text, int start, int end)
COMPLETE_WITH_LIST(list_POLICYOPTIONS);
}
/*
* Complete "CREATE POLICY <name> ON <table> FOR SELECT TO|USING"
* Complete "CREATE POLICY <name> ON <table> FOR DELETE TO|USING"
* Complete "CREATE POLICY <name> ON <table> FOR SELECT TO|USING" Complete
* "CREATE POLICY <name> ON <table> FOR DELETE TO|USING"
*/
else if (pg_strcasecmp(prev6_wd, "POLICY") == 0 &&
pg_strcasecmp(prev4_wd, "ON") == 0 &&
pg_strcasecmp(prev2_wd, "FOR") == 0 &&
(pg_strcasecmp(prev_wd, "SELECT") == 0 ||
pg_strcasecmp(prev_wd, "DELETE") == 0))
pg_strcasecmp(prev_wd, "DELETE") == 0))
{
static const char *const list_POLICYOPTIONS[] =
{"TO", "USING", NULL};
COMPLETE_WITH_LIST(list_POLICYOPTIONS);
}
/*
* Complete "CREATE POLICY <name> ON <table> FOR ALL TO|USING|WITH CHECK"
* Complete "CREATE POLICY <name> ON <table> FOR UPDATE TO|USING|WITH CHECK"
* Complete "CREATE POLICY <name> ON <table> FOR UPDATE TO|USING|WITH
* CHECK"
*/
else if (pg_strcasecmp(prev6_wd, "POLICY") == 0 &&
pg_strcasecmp(prev4_wd, "ON") == 0 &&
pg_strcasecmp(prev2_wd, "FOR") == 0 &&
(pg_strcasecmp(prev_wd, "ALL") == 0 ||
pg_strcasecmp(prev_wd, "UPDATE") == 0))
pg_strcasecmp(prev_wd, "UPDATE") == 0))
{
static const char *const list_POLICYOPTIONS[] =
{"TO", "USING", "WITH CHECK", NULL};
@ -3336,7 +3344,7 @@ psql_completion(const char *text, int start, int end)
else if (pg_strcasecmp(prev_wd, "REINDEX") == 0)
{
static const char *const list_REINDEX[] =
{"TABLE", "INDEX", "SYSTEM", "SCHEMA", "DATABASE", NULL};
{"TABLE", "INDEX", "SYSTEM", "SCHEMA", "DATABASE", NULL};
COMPLETE_WITH_LIST(list_REINDEX);
}
@ -3346,7 +3354,7 @@ psql_completion(const char *text, int start, int end)
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tm, NULL);
else if (pg_strcasecmp(prev_wd, "INDEX") == 0)
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_indexes, NULL);
else if (pg_strcasecmp(prev_wd, "SCHEMA") == 0 )
else if (pg_strcasecmp(prev_wd, "SCHEMA") == 0)
COMPLETE_WITH_QUERY(Query_for_list_of_schemas);
else if (pg_strcasecmp(prev_wd, "SYSTEM") == 0 ||
pg_strcasecmp(prev_wd, "DATABASE") == 0)
@ -4374,7 +4382,7 @@ complete_from_variables(const char *text, const char *prefix, const char *suffix
"ENCODING", "FETCH_COUNT", "HISTCONTROL", "HISTFILE", "HISTSIZE",
"HOST", "IGNOREEOF", "LASTOID", "ON_ERROR_ROLLBACK", "ON_ERROR_STOP",
"PORT", "PROMPT1", "PROMPT2", "PROMPT3", "QUIET", "SINGLELINE",
"SINGLESTEP", "USER", "VERBOSITY", NULL
"SINGLESTEP", "USER", "VERBOSITY", NULL
};
varnames = (char **) pg_malloc((maxvars + 1) * sizeof(char *));
@ -4390,7 +4398,7 @@ complete_from_variables(const char *text, const char *prefix, const char *suffix
{
if (need_value && !(ptr->value))
continue;
for (i = 0; known_varnames[i]; i++) /* remove duplicate entry */
for (i = 0; known_varnames[i]; i++) /* remove duplicate entry */
{
if (strcmp(ptr->name, known_varnames[i]) == 0)
continue;
@ -4475,7 +4483,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++)