From b9594869b037aefd79078c88c87cfde1faa0edcd Mon Sep 17 00:00:00 2001 From: momjian Date: Tue, 6 Jan 2009 23:01:57 +0000 Subject: [PATCH] Add documentation for new \d*S* patch, and clean up some of the docs. Fix \do and trigger display for the patch too. --- doc/src/sgml/ref/psql-ref.sgml | 73 +++++++++++++++++++++++------------------- src/bin/psql/describe.c | 4 +-- src/bin/psql/help.c | 62 +++++++++++++++++------------------ 3 files changed, 73 insertions(+), 66 deletions(-) diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml index b8f47c0f5f..a2c8e7d72c 100644 --- a/doc/src/sgml/ref/psql-ref.sgml +++ b/doc/src/sgml/ref/psql-ref.sgml @@ -815,8 +815,7 @@ testdb=> - \d [ pattern ] - \d+ [ pattern ] + \d[S+] [ pattern ] @@ -834,6 +833,8 @@ testdb=> more information is displayed: any comments associated with the columns of the table are shown, as is the presence of OIDs in the table. + The letter S restricts the listing to system objects; without + S, only non-system objects are shown. @@ -849,7 +850,7 @@ testdb=> - \da [ pattern ] + \da[S] [ pattern ] @@ -857,14 +858,16 @@ testdb=> return type and the data types they operate on. If pattern is specified, only aggregates whose names match the pattern are shown. + The letter S restricts the listing + to system objects; without S, only + non-system objects are shown. - \db [ pattern ] - \db+ [ pattern ] + \db[+] [ pattern ] @@ -879,13 +882,15 @@ testdb=> - \dc [ pattern ] + \dc[S] [ pattern ] Lists all available conversions between character-set encodings. If pattern is specified, only conversions whose names match the pattern are listed. + The letter S restricts the listing to system objects; without + S, only non-system objects are shown. @@ -905,13 +910,15 @@ testdb=> - \dd [ pattern ] + \dd[S] [ pattern ] Shows the descriptions of objects matching the pattern, or of all visible objects if no argument is given. But in either case, only objects that have a description are listed. + The letter S restricts the listing to system objects; without + S, only non-system objects are shown. (Object covers aggregates, functions, operators, types, relations (tables, views, indexes, sequences, large objects), rules, and triggers.) For example: @@ -935,20 +942,21 @@ testdb=> - \dD [ pattern ] + \dD[S] [ pattern ] Lists all available domains. If pattern is specified, only matching domains are shown. + The letter S restricts the listing to system objects; without + S, only non-system objects are shown. - \des [ pattern ] - \des+ [ pattern ] + \des[+] [ pattern ] Lists all foreign servers (mnemonic: external @@ -964,8 +972,7 @@ testdb=> - \deu [ pattern ] - \deu+ [ pattern ] + \deu[+] [ pattern ] Lists all user mappings (mnemonic: external @@ -988,8 +995,7 @@ testdb=> - \dew [ pattern ] - \dew+ [ pattern ] + \dew[+] [ pattern ] Lists all foreign-data wrappers (mnemonic: external @@ -1005,8 +1011,7 @@ testdb=> - \df [ pattern ] - \df+ [ pattern ] + \df[S+] [ pattern ] @@ -1016,6 +1021,8 @@ testdb=> is specified, only functions whose names match the pattern are shown. If the form \df+ is used, additional information about each function, including volatility, language, source code and description, is shown. + The letter S restricts the listing to system objects; without + S, only non-system objects are shown. @@ -1037,8 +1044,7 @@ testdb=> - \dF [ pattern ] - \dF+ [ pattern ] + \dF[+] [ pattern ] Lists available text search configurations. @@ -1052,8 +1058,7 @@ testdb=> - \dFd [ pattern ] - \dFd+ [ pattern ] + \dFd[+] [ pattern ] Lists available text search dictionaries. @@ -1067,8 +1072,7 @@ testdb=> - \dFp [ pattern ] - \dFp+ [ pattern ] + \dFp[+] [ pattern ] Lists available text search parsers. @@ -1082,8 +1086,7 @@ testdb=> - \dFt [ pattern ] - \dFt+ [ pattern ] + \dFt[+] [ pattern ] Lists available text search templates. @@ -1110,7 +1113,7 @@ testdb=> - \distvS [ pattern ] + \distv[S+] [ pattern ] @@ -1120,11 +1123,12 @@ testdb=> S stand for index, sequence, table, view, and system table, respectively. You can specify any or all of these letters, in any order, to obtain a listing of all the - matching objects. The letter S restricts - the listing to system objects; without S, - only non-system objects are shown. If + is + matching objects. If + is appended to the command name, each object is listed with its physical size on disk and its associated description, if any. + The letter S restricts the listing + to system objects; without S, only + non-system objects are shown. @@ -1147,8 +1151,7 @@ testdb=> - \dn [ pattern ] - \dn+ [ pattern ] + \dn[+] [ pattern ] @@ -1164,12 +1167,15 @@ testdb=> - \do [ pattern ] + \do[S] [ pattern ] Lists available operators with their operand and return types. If pattern is specified, only operators whose names match the pattern are listed. + The letter S restricts the listing + to system objects; without S, only + non-system objects are shown. @@ -1195,14 +1201,15 @@ testdb=> - \dT [ pattern ] - \dT+ [ pattern ] + \dT[S+] [ pattern ] Lists all data types or only those that match pattern. The command form \dT+ shows extra information, namely the type's internal name, size, and allowed values for enum types. + The letter S restricts the listing to system objects; without + S, only non-system objects are shown. diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index 8541352e56..37695d37ff 100644 --- a/src/bin/psql/describe.c +++ b/src/bin/psql/describe.c @@ -428,7 +428,7 @@ describeOperators(const char *pattern, bool showSystem) gettext_noop("Description")); if (!showSystem) - appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n"); + appendPQExpBuffer(&buf, " WHERE n.nspname <> 'pg_catalog'\n"); processSQLNamePattern(pset.db, &buf, pattern, !showSystem, true, "n.nspname", "o.oprname", NULL, @@ -743,7 +743,7 @@ objectDescription(const char *pattern, bool showSystem) " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n", gettext_noop("trigger")); if (!showSystem) - appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n"); + appendPQExpBuffer(&buf, " WHERE n.nspname <> 'pg_catalog'\n"); /* XXX not sure what to do about visibility rule here? */ processSQLNamePattern(pset.db, &buf, pattern, !showSystem, false, diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c index 0c1de28e35..0e3d6d9b30 100644 --- a/src/bin/psql/help.c +++ b/src/bin/psql/help.c @@ -194,37 +194,37 @@ slashUsage(unsigned short int pager) fprintf(output, "\n"); fprintf(output, _("Informational\n")); - fprintf(output, _(" Modifiers: S = show system objects + = Additional detail\n")); - fprintf(output, _(" \\l[+] list all databases\n")); - fprintf(output, _(" \\d[S] list tables, views, and sequences\n")); - fprintf(output, _(" \\d[S] NAME describe table, view, sequence, or index\n")); - fprintf(output, _(" \\dt[S+] [PATTERN] list tables\n")); - fprintf(output, _(" \\dv[S+] [PATTERN] list views\n")); - fprintf(output, _(" \\ds[S+] [PATTERN] list sequences\n")); - fprintf(output, _(" \\di[S+] [PATTERN] list indexes\n")); - fprintf(output, _(" \\df[S+] [PATTERN] list functions\n")); - fprintf(output, _(" \\dT[S+] [PATTERN] list data types\n")); - fprintf(output, _(" \\dd[S] [PATTERN] list comments on objects\n")); - fprintf(output, _(" \\dD[S] [PATTERN] list domains\n")); - fprintf(output, _(" \\des[+] [PATTERN] list foreign servers\n")); - fprintf(output, _(" \\deu[+] [PATTERN] list user mappings\n")); - fprintf(output, _(" \\dew[+] [PATTERN] list foreign-data wrappers\n")); - fprintf(output, _(" \\do[S] [PATTERN] list operators\n")); - fprintf(output, _(" \\da[S] [PATTERN] list aggregate functions\n")); - fprintf(output, _(" \\dc[S] [PATTERN] list conversions\n")); - fprintf(output, _(" \\db[+] [PATTERN] list tablespaces\n")); - fprintf(output, _(" \\dn[+] [PATTERN] list schemas\n")); - fprintf(output, _(" \\dC list casts\n")); - fprintf(output, _(" \\dd [PATTERN] show comment for object\n")); - fprintf(output, _(" \\dF[+] [PATTERN] list text search configurations\n")); - fprintf(output, _(" \\dFd[+] [PATTERN] list text search dictionaries\n")); - fprintf(output, _(" \\dFt [PATTERN] list text search templates\n")); - fprintf(output, _(" \\dFp[+] [PATTERN] list text search parsers\n")); - fprintf(output, _(" \\dg [PATTERN] list roles (groups)\n")); - fprintf(output, _(" \\dl list large objects, same as \\lo_list\n")); - fprintf(output, _(" \\du [PATTERN] list roles (users)\n")); - fprintf(output, _(" \\dp [PATTERN] list table, view, and sequence access privileges\n")); - fprintf(output, _(" \\z [PATTERN] same as \\dp\n")); + fprintf(output, _(" Modifiers: S = show system objects + = Additional detail\n")); + fprintf(output, _(" \\l[+] list all databases\n")); + fprintf(output, _(" \\d[S+] list tables, views, and sequences\n")); + fprintf(output, _(" \\d[S+] NAME describe table, view, sequence, or index\n")); + fprintf(output, _(" \\da[S] [PATTERN] list aggregate functions\n")); + fprintf(output, _(" \\db[+] [PATTERN] list tablespaces\n")); + fprintf(output, _(" \\dc[S] [PATTERN] list conversions\n")); + fprintf(output, _(" \\dC [PATTERN] list casts\n")); + fprintf(output, _(" \\dd [PATTERN] show comment for object\n")); + fprintf(output, _(" \\dd[S] [PATTERN] list comments on objects\n")); + fprintf(output, _(" \\dD[S] [PATTERN] list domains\n")); + fprintf(output, _(" \\des[+] [PATTERN] list foreign servers\n")); + fprintf(output, _(" \\deu[+] [PATTERN] list user mappings\n")); + fprintf(output, _(" \\dew[+] [PATTERN] list foreign-data wrappers\n")); + fprintf(output, _(" \\df[S+] [PATTERN] list functions\n")); + fprintf(output, _(" \\dF[+] [PATTERN] list text search configurations\n")); + fprintf(output, _(" \\dFd[+] [PATTERN] list text search dictionaries\n")); + fprintf(output, _(" \\dFp[+] [PATTERN] list text search parsers\n")); + fprintf(output, _(" \\dFt[+] [PATTERN] list text search templates\n")); + fprintf(output, _(" \\dg [PATTERN] list roles (groups)\n")); + fprintf(output, _(" \\di[S+] [PATTERN] list indexes\n")); + fprintf(output, _(" \\dl list large objects, same as \\lo_list\n")); + fprintf(output, _(" \\dn[+] [PATTERN] list schemas\n")); + fprintf(output, _(" \\do[S] [PATTERN] list operators\n")); + fprintf(output, _(" \\dp [PATTERN] list table, view, and sequence access privileges\n")); + fprintf(output, _(" \\z [PATTERN] same as \\dp\n")); + fprintf(output, _(" \\ds[S+] [PATTERN] list sequences\n")); + fprintf(output, _(" \\dt[S+] [PATTERN] list tables\n")); + fprintf(output, _(" \\dT[S+] [PATTERN] list data types\n")); + fprintf(output, _(" \\du [PATTERN] list roles (users)\n")); + fprintf(output, _(" \\dv[S+] [PATTERN] list views\n")); fprintf(output, "\n"); fprintf(output, _("Formatting\n")); -- 2.11.4.GIT