summaryrefslogtreecommitdiff
path: root/src/bin/psql
diff options
context:
space:
mode:
authorPavan Deolasee2017-06-15 07:41:07 +0000
committerPavan Deolasee2017-06-15 07:41:07 +0000
commit0ffa504a17f58f2bc045b0039f40e4917ee50d20 (patch)
treec629c449bcfcc45de1d03b2586e89932d546e8ba /src/bin/psql
parent36ccc8d64e61fe9d77bb7ac62267945f7c146baa (diff)
parente800656d9a9b40b2f55afabe76354ab6d93353b3 (diff)
Merge 'remotes/PGSQL/master' into xl10devel
Merge upstream master branch upto e800656d9a9b40b2f55afabe76354ab6d93353b3. Code compiles and regression works ok (with lots and lots of failures though).
Diffstat (limited to 'src/bin/psql')
-rw-r--r--src/bin/psql/describe.c27
-rw-r--r--src/bin/psql/help.c14
-rw-r--r--src/bin/psql/tab-complete.c42
3 files changed, 54 insertions, 29 deletions
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 61c3c63c31..69fc7e6ba0 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -1732,7 +1732,7 @@ describeOneTableDetails(const char *schemaname,
headers[cols++] = gettext_noop("Definition");
if (tableinfo.relkind == RELKIND_FOREIGN_TABLE && pset.sversion >= 90200)
- headers[cols++] = gettext_noop("FDW Options");
+ headers[cols++] = gettext_noop("FDW options");
if (verbose)
{
@@ -2543,10 +2543,9 @@ describeOneTableDetails(const char *schemaname,
{
printfPQExpBuffer(&buf,
"SELECT pub.pubname\n"
- " FROM pg_catalog.pg_publication pub\n"
- " LEFT JOIN pg_catalog.pg_publication_rel pr\n"
- " ON (pr.prpubid = pub.oid)\n"
- "WHERE pr.prrelid = '%s' OR pub.puballtables\n"
+ " FROM pg_catalog.pg_publication pub,\n"
+ " pg_catalog.pg_get_publication_tables(pub.pubname)\n"
+ "WHERE relid = '%s'\n"
"ORDER BY 1;",
oid);
@@ -2793,7 +2792,7 @@ describeOneTableDetails(const char *schemaname,
ftoptions = PQgetvalue(result, 0, 1);
if (ftoptions && ftoptions[0] != '\0')
{
- printfPQExpBuffer(&buf, _("FDW Options: (%s)"), ftoptions);
+ printfPQExpBuffer(&buf, _("FDW options: (%s)"), ftoptions);
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
@@ -3531,12 +3530,12 @@ listLanguages(const char *pattern, bool verbose, bool showSystem)
",\n NOT l.lanispl AS \"%s\",\n"
" l.lanplcallfoid::regprocedure AS \"%s\",\n"
" l.lanvalidator::regprocedure AS \"%s\",\n ",
- gettext_noop("Internal Language"),
- gettext_noop("Call Handler"),
+ gettext_noop("Internal language"),
+ gettext_noop("Call handler"),
gettext_noop("Validator"));
if (pset.sversion >= 90000)
appendPQExpBuffer(&buf, "l.laninline::regprocedure AS \"%s\",\n ",
- gettext_noop("Inline Handler"));
+ gettext_noop("Inline handler"));
printACLColumn(&buf, "l.lanacl");
}
@@ -4670,7 +4669,7 @@ listForeignDataWrappers(const char *pattern, bool verbose)
" quote_literal(option_value) FROM "
" pg_options_to_table(fdwoptions)), ', ') || ')' "
" END AS \"%s\"",
- gettext_noop("FDW Options"));
+ gettext_noop("FDW options"));
if (pset.sversion >= 90100)
appendPQExpBuffer(&buf,
@@ -4754,7 +4753,7 @@ listForeignServers(const char *pattern, bool verbose)
" d.description AS \"%s\"",
gettext_noop("Type"),
gettext_noop("Version"),
- gettext_noop("FDW Options"),
+ gettext_noop("FDW options"),
gettext_noop("Description"));
}
@@ -4825,7 +4824,7 @@ listUserMappings(const char *pattern, bool verbose)
" quote_literal(option_value) FROM "
" pg_options_to_table(umoptions)), ', ') || ')' "
" END AS \"%s\"",
- gettext_noop("FDW Options"));
+ gettext_noop("FDW options"));
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_user_mappings um\n");
@@ -4889,7 +4888,7 @@ listForeignTables(const char *pattern, bool verbose)
" pg_options_to_table(ftoptions)), ', ') || ')' "
" END AS \"%s\",\n"
" d.description AS \"%s\"",
- gettext_noop("FDW Options"),
+ gettext_noop("FDW options"),
gettext_noop("Description"));
appendPQExpBufferStr(&buf,
@@ -5075,7 +5074,7 @@ listOneExtensionContents(const char *extname, const char *oid)
"FROM pg_catalog.pg_depend\n"
"WHERE refclassid = 'pg_catalog.pg_extension'::pg_catalog.regclass AND refobjid = '%s' AND deptype = 'e'\n"
"ORDER BY 1;",
- gettext_noop("Object Description"),
+ gettext_noop("Object description"),
oid);
res = PSQLexec(buf.data);
diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c
index ac435220e6..f097b06594 100644
--- a/src/bin/psql/help.c
+++ b/src/bin/psql/help.c
@@ -171,13 +171,13 @@ slashUsage(unsigned short int pager)
fprintf(output, _("General\n"));
fprintf(output, _(" \\copyright show PostgreSQL usage and distribution terms\n"));
+ fprintf(output, _(" \\crosstabview [COLUMNS] execute query and display results in crosstab\n"));
fprintf(output, _(" \\errverbose show most recent error message at maximum verbosity\n"));
fprintf(output, _(" \\g [FILE] or ; execute query (and send results to file or |pipe)\n"));
- fprintf(output, _(" \\gx [FILE] as \\g, but forces expanded output mode\n"));
fprintf(output, _(" \\gexec execute query, then execute each value in its result\n"));
fprintf(output, _(" \\gset [PREFIX] execute query and store results in psql variables\n"));
+ fprintf(output, _(" \\gx [FILE] as \\g, but forces expanded output mode\n"));
fprintf(output, _(" \\q quit psql\n"));
- fprintf(output, _(" \\crosstabview [COLUMNS] execute query and display results in crosstab\n"));
fprintf(output, _(" \\watch [SEC] execute query every SEC seconds\n"));
fprintf(output, "\n");
@@ -227,8 +227,9 @@ slashUsage(unsigned short int pager)
fprintf(output, _(" \\dc[S+] [PATTERN] list conversions\n"));
fprintf(output, _(" \\dC[+] [PATTERN] list casts\n"));
fprintf(output, _(" \\dd[S] [PATTERN] show object descriptions not displayed elsewhere\n"));
- fprintf(output, _(" \\ddp [PATTERN] list default privileges\n"));
fprintf(output, _(" \\dD[S+] [PATTERN] list domains\n"));
+ fprintf(output, _(" \\ddp [PATTERN] list default privileges\n"));
+ fprintf(output, _(" \\dE[S+] [PATTERN] list foreign tables\n"));
fprintf(output, _(" \\det[+] [PATTERN] list foreign tables\n"));
fprintf(output, _(" \\des[+] [PATTERN] list foreign servers\n"));
fprintf(output, _(" \\deu[+] [PATTERN] list user mappings\n"));
@@ -255,7 +256,6 @@ slashUsage(unsigned short int pager)
fprintf(output, _(" \\dT[S+] [PATTERN] list data types\n"));
fprintf(output, _(" \\du[S+] [PATTERN] list roles\n"));
fprintf(output, _(" \\dv[S+] [PATTERN] list views\n"));
- fprintf(output, _(" \\dE[S+] [PATTERN] list foreign tables\n"));
fprintf(output, _(" \\dx[+] [PATTERN] list extensions\n"));
fprintf(output, _(" \\dy [PATTERN] list event triggers\n"));
fprintf(output, _(" \\l[+] [PATTERN] list databases\n"));
@@ -289,9 +289,9 @@ slashUsage(unsigned short int pager)
else
fprintf(output, _(" \\c[onnect] {[DBNAME|- USER|- HOST|- PORT|-] | conninfo}\n"
" connect to new database (currently no connection)\n"));
+ fprintf(output, _(" \\conninfo display information about current connection\n"));
fprintf(output, _(" \\encoding [ENCODING] show or set client encoding\n"));
fprintf(output, _(" \\password [USERNAME] securely change the password for a user\n"));
- fprintf(output, _(" \\conninfo display information about current connection\n"));
fprintf(output, "\n");
fprintf(output, _("Operating System\n"));
@@ -413,10 +413,10 @@ helpVariables(unsigned short int pager)
fprintf(output, _(" PGAPPNAME same as the application_name connection parameter\n"));
fprintf(output, _(" PGDATABASE same as the dbname connection parameter\n"));
fprintf(output, _(" PGHOST same as the host connection parameter\n"));
- fprintf(output, _(" PGPORT same as the port connection parameter\n"));
- fprintf(output, _(" PGUSER same as the user connection parameter\n"));
fprintf(output, _(" PGPASSWORD connection password (not recommended)\n"));
fprintf(output, _(" PGPASSFILE password file name\n"));
+ fprintf(output, _(" PGPORT same as the port connection parameter\n"));
+ fprintf(output, _(" PGUSER same as the user connection parameter\n"));
fprintf(output, _(" PSQL_EDITOR, EDITOR, VISUAL\n"
" editor used by the \\e, \\ef, and \\ev commands\n"));
fprintf(output, _(" PSQL_EDITOR_LINENUMBER_ARG\n"
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 04e6a21bb3..e1f33175e2 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -1436,19 +1436,33 @@ psql_completion(const char *text, int start, int end)
/* psql's backslash commands. */
static const char *const backslash_commands[] = {
- "\\a", "\\connect", "\\conninfo", "\\C", "\\cd", "\\copy",
+ "\\a",
+ "\\connect", "\\conninfo", "\\C", "\\cd", "\\copy",
"\\copyright", "\\crosstabview",
"\\d", "\\da", "\\dA", "\\db", "\\dc", "\\dC", "\\dd", "\\ddp", "\\dD",
"\\des", "\\det", "\\deu", "\\dew", "\\dE", "\\df",
"\\dF", "\\dFd", "\\dFp", "\\dFt", "\\dg", "\\di", "\\dl", "\\dL",
- "\\dm", "\\dn", "\\do", "\\dO", "\\dp", "\\drds", "\\ds", "\\dS",
+ "\\dm", "\\dn", "\\do", "\\dO", "\\dp",
+ "\\drds", "\\dRs", "\\dRp", "\\ds", "\\dS",
"\\dt", "\\dT", "\\dv", "\\du", "\\dx", "\\dy",
- "\\e", "\\echo", "\\ef", "\\encoding", "\\errverbose", "\\ev",
- "\\f", "\\g", "\\gexec", "\\gset", "\\gx", "\\h", "\\help", "\\H",
- "\\i", "\\ir", "\\l", "\\lo_import", "\\lo_export", "\\lo_list",
- "\\lo_unlink", "\\o", "\\p", "\\password", "\\prompt", "\\pset", "\\q",
- "\\qecho", "\\r", "\\s", "\\set", "\\setenv", "\\sf", "\\sv", "\\t",
- "\\T", "\\timing", "\\unset", "\\x", "\\w", "\\watch", "\\z", "\\!",
+ "\\e", "\\echo", "\\ef", "\\elif", "\\else", "\\encoding",
+ "\\endif", "\\errverbose", "\\ev",
+ "\\f",
+ "\\g", "\\gexec", "\\gset", "\\gx",
+ "\\h", "\\help", "\\H",
+ "\\i", "\\if", "\\ir",
+ "\\l", "\\lo_import", "\\lo_export", "\\lo_list", "\\lo_unlink",
+ "\\o",
+ "\\p", "\\password", "\\prompt", "\\pset",
+ "\\q", "\\qecho",
+ "\\r",
+ "\\s", "\\set", "\\setenv", "\\sf", "\\sv",
+ "\\t", "\\T", "\\timing",
+ "\\unset",
+ "\\x",
+ "\\w", "\\watch",
+ "\\z",
+ "\\!", "\\?",
NULL
};
@@ -1592,6 +1606,18 @@ psql_completion(const char *text, int start, int end)
{
/* complete with nothing here as this refers to remote publications */
}
+ /* ALTER SUBSCRIPTION <name> SET PUBLICATION <name> */
+ else if (HeadMatches3("ALTER", "SUBSCRIPTION", MatchAny) &&
+ TailMatches3("SET", "PUBLICATION", MatchAny))
+ {
+ COMPLETE_WITH_CONST("WITH (");
+ }
+ /* ALTER SUBSCRIPTION <name> SET PUBLICATION <name> WITH ( */
+ else if (HeadMatches3("ALTER", "SUBSCRIPTION", MatchAny) &&
+ TailMatches5("SET", "PUBLICATION", MatchAny, "WITH", "("))
+ {
+ COMPLETE_WITH_LIST2("copy_data", "refresh");
+ }
/* ALTER SCHEMA <name> */
else if (Matches3("ALTER", "SCHEMA", MatchAny))
COMPLETE_WITH_LIST2("OWNER TO", "RENAME TO");