Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 33e7eac

Browse files
committed
Change psql \d* display so 'S' _or_ a pattern include system objects.
1 parent 248891f commit 33e7eac

File tree

2 files changed

+50
-50
lines changed

2 files changed

+50
-50
lines changed

doc/src/sgml/ref/psql-ref.sgml

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.220 2009/02/26 16:02:37 petere Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.221 2009/04/02 15:15:31 momjian Exp $
33
PostgreSQL documentation
44
-->
55

@@ -853,9 +853,9 @@ testdb=&gt;
853853
more information is displayed: any comments associated with the
854854
columns of the table are shown, as is the presence of OIDs in the
855855
table.
856-
The letter <literal>S</literal> adds the listing of system
857-
objects; without <literal>S</literal>, only non-system
858-
objects are shown.
856+
By default, only user-created objects are shown; supply a
857+
pattern or the <literal>S</literal> modifier to include system
858+
objects.
859859
</para>
860860

861861
<note>
@@ -879,9 +879,9 @@ testdb=&gt;
879879
return type and the data types they operate on. If <replaceable
880880
class="parameter">pattern</replaceable>
881881
is specified, only aggregates whose names match the pattern are shown.
882-
The letter <literal>S</literal> adds the listing of system
883-
objects; without <literal>S</literal>, only non-system
884-
objects are shown.
882+
By default, only user-created objects are shown; supply a
883+
pattern or the <literal>S</literal> modifier to include system
884+
objects.
885885
</para>
886886
</listitem>
887887
</varlistentry>
@@ -910,9 +910,9 @@ testdb=&gt;
910910
If <replaceable class="parameter">pattern</replaceable>
911911
is specified, only conversions whose names match the pattern are
912912
listed.
913-
The letter <literal>S</literal> adds the listing of system
914-
objects; without <literal>S</literal>, only non-system
915-
objects are shown.
913+
By default, only user-created objects are shown; supply a
914+
pattern or the <literal>S</literal> modifier to include system
915+
objects.
916916
</para>
917917
</listitem>
918918
</varlistentry>
@@ -939,9 +939,9 @@ testdb=&gt;
939939
class="parameter">pattern</replaceable>, or of all visible objects if
940940
no argument is given. But in either case, only objects that have
941941
a description are listed.
942-
The letter <literal>S</literal> adds the listing of system
943-
objects; without <literal>S</literal>, only non-system
944-
objects are shown.
942+
By default, only user-created objects are shown; supply a
943+
pattern or the <literal>S</literal> modifier to include system
944+
objects.
945945
(<quote>Object</quote> covers aggregates, functions, operators,
946946
types, relations (tables, views, indexes, sequences, large
947947
objects), rules, and triggers.) For example:
@@ -971,9 +971,9 @@ testdb=&gt;
971971
Lists all available domains. If <replaceable
972972
class="parameter">pattern</replaceable>
973973
is specified, only matching domains are shown.
974-
The letter <literal>S</literal> adds the listing of system
975-
objects; without <literal>S</literal>, only non-system
976-
objects are shown.
974+
By default, only user-created objects are shown; supply a
975+
pattern or the <literal>S</literal> modifier to include system
976+
objects.
977977
</para>
978978
</listitem>
979979
</varlistentry>
@@ -1045,9 +1045,9 @@ testdb=&gt;
10451045
is specified, only functions whose names match the pattern are shown.
10461046
If the form <literal>\df+</literal> is used, additional information about
10471047
each function, including volatility, language, source code and description, is shown.
1048-
The letter <literal>S</literal> adds the listing of system
1049-
objects; without <literal>S</literal>, only non-system
1050-
objects are shown.
1048+
By default, only user-created objects are shown; supply a
1049+
pattern or the <literal>S</literal> modifier to include system
1050+
objects.
10511051
</para>
10521052

10531053
<note>
@@ -1155,9 +1155,9 @@ testdb=&gt;
11551155
and tables. If <literal>+</literal> is
11561156
appended to the command name, each object is listed with its
11571157
physical size on disk and its associated description, if any.
1158-
The letter <literal>S</literal> adds the listing of system
1159-
objects; without <literal>S</literal>, only non-system
1160-
objects are shown.
1158+
By default, only user-created objects are shown; supply a
1159+
pattern or the <literal>S</literal> modifier to include system
1160+
objects.
11611161
</para>
11621162

11631163
<para>
@@ -1202,9 +1202,9 @@ testdb=&gt;
12021202
Lists available operators with their operand and return types.
12031203
If <replaceable class="parameter">pattern</replaceable> is
12041204
specified, only operators whose names match the pattern are listed.
1205-
The letter <literal>S</literal> adds the listing of system
1206-
objects; without <literal>S</literal>, only non-system
1207-
objects are shown.
1205+
By default, only user-created objects are shown; supply a
1206+
pattern or the <literal>S</literal> modifier to include system
1207+
objects.
12081208
</para>
12091209
</listitem>
12101210
</varlistentry>
@@ -1237,9 +1237,9 @@ testdb=&gt;
12371237
class="parameter">pattern</replaceable>. The command form
12381238
<literal>\dT+</literal> shows extra information, namely the type's internal name, size, and
12391239
allowed values for <type>enum</> types.
1240-
The letter <literal>S</literal> adds the listing of system
1241-
objects; without <literal>S</literal>, only non-system
1242-
objects are shown.
1240+
By default, only user-created objects are shown; supply a
1241+
pattern or the <literal>S</literal> modifier to include system
1242+
objects.
12431243
</para>
12441244
</listitem>
12451245
</varlistentry>

src/bin/psql/describe.c

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
* Copyright (c) 2000-2009, PostgreSQL Global Development Group
1010
*
11-
* $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.203 2009/03/26 22:26:07 petere Exp $
11+
* $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.204 2009/04/02 15:15:32 momjian Exp $
1212
*/
1313
#include "postgres_fe.h"
1414

@@ -94,7 +94,7 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
9494
"WHERE p.proisagg\n",
9595
gettext_noop("Description"));
9696

97-
if (!showSystem)
97+
if (!showSystem && !pattern)
9898
appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n");
9999

100100
processSQLNamePattern(pset.db, &buf, pattern, true, false,
@@ -281,7 +281,7 @@ describeFunctions(const char *pattern, bool verbose, bool showSystem)
281281
" AND p.proargtypes[0] IS DISTINCT FROM 'pg_catalog.cstring'::pg_catalog.regtype\n"
282282
" AND NOT p.proisagg\n");
283283

284-
if (!showSystem)
284+
if (!showSystem && !pattern)
285285
appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n");
286286

287287
processSQLNamePattern(pset.db, &buf, pattern, true, false,
@@ -372,7 +372,7 @@ describeTypes(const char *pattern, bool verbose, bool showSystem)
372372
else
373373
appendPQExpBuffer(&buf, " AND t.typname !~ '^_'\n");
374374

375-
if (!showSystem)
375+
if (!showSystem && !pattern)
376376
appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n");
377377

378378
/* Match name pattern against either internal or external name */
@@ -427,10 +427,10 @@ describeOperators(const char *pattern, bool showSystem)
427427
gettext_noop("Result type"),
428428
gettext_noop("Description"));
429429

430-
if (!showSystem)
430+
if (!showSystem && !pattern)
431431
appendPQExpBuffer(&buf, " WHERE n.nspname <> 'pg_catalog'\n");
432432

433-
processSQLNamePattern(pset.db, &buf, pattern, !showSystem, true,
433+
processSQLNamePattern(pset.db, &buf, pattern, !showSystem && !pattern, true,
434434
"n.nspname", "o.oprname", NULL,
435435
"pg_catalog.pg_operator_is_visible(o.oid)");
436436

@@ -631,7 +631,7 @@ objectDescription(const char *pattern, bool showSystem)
631631
" WHERE p.proisagg\n",
632632
gettext_noop("aggregate"));
633633

634-
if (!showSystem)
634+
if (!showSystem && !pattern)
635635
appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n");
636636

637637
processSQLNamePattern(pset.db, &buf, pattern, true, false,
@@ -654,7 +654,7 @@ objectDescription(const char *pattern, bool showSystem)
654654
" AND NOT p.proisagg\n",
655655
gettext_noop("function"));
656656

657-
if (!showSystem)
657+
if (!showSystem && !pattern)
658658
appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n");
659659

660660
processSQLNamePattern(pset.db, &buf, pattern, true, false,
@@ -672,10 +672,10 @@ objectDescription(const char *pattern, bool showSystem)
672672
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = o.oprnamespace\n",
673673
gettext_noop("operator"));
674674

675-
if (!showSystem)
675+
if (!showSystem && !pattern)
676676
appendPQExpBuffer(&buf, " WHERE n.nspname <> 'pg_catalog'\n");
677677

678-
processSQLNamePattern(pset.db, &buf, pattern, !showSystem, false,
678+
processSQLNamePattern(pset.db, &buf, pattern, !showSystem && !pattern, false,
679679
"n.nspname", "o.oprname", NULL,
680680
"pg_catalog.pg_operator_is_visible(o.oid)");
681681

@@ -690,10 +690,10 @@ objectDescription(const char *pattern, bool showSystem)
690690
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace\n",
691691
gettext_noop("data type"));
692692

693-
if (!showSystem)
693+
if (!showSystem && !pattern)
694694
appendPQExpBuffer(&buf, " WHERE n.nspname <> 'pg_catalog'\n");
695695

696-
processSQLNamePattern(pset.db, &buf, pattern, !showSystem, false,
696+
processSQLNamePattern(pset.db, &buf, pattern, !showSystem && !pattern, false,
697697
"n.nspname", "pg_catalog.format_type(t.oid, NULL)",
698698
NULL,
699699
"pg_catalog.pg_type_is_visible(t.oid)");
@@ -714,7 +714,7 @@ objectDescription(const char *pattern, bool showSystem)
714714
gettext_noop("view"),
715715
gettext_noop("index"),
716716
gettext_noop("sequence"));
717-
if (!showSystem)
717+
if (!showSystem && !pattern)
718718
appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n");
719719

720720
processSQLNamePattern(pset.db, &buf, pattern, true, false,
@@ -734,7 +734,7 @@ objectDescription(const char *pattern, bool showSystem)
734734
" WHERE r.rulename != '_RETURN'\n",
735735
gettext_noop("rule"));
736736

737-
if (!showSystem)
737+
if (!showSystem && !pattern)
738738
appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n");
739739

740740
/* XXX not sure what to do about visibility rule here? */
@@ -753,11 +753,11 @@ objectDescription(const char *pattern, bool showSystem)
753753
" JOIN pg_catalog.pg_class c ON c.oid = t.tgrelid\n"
754754
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n",
755755
gettext_noop("trigger"));
756-
if (!showSystem)
756+
if (!showSystem && !pattern)
757757
appendPQExpBuffer(&buf, " WHERE n.nspname <> 'pg_catalog'\n");
758758

759759
/* XXX not sure what to do about visibility rule here? */
760-
processSQLNamePattern(pset.db, &buf, pattern, !showSystem, false,
760+
processSQLNamePattern(pset.db, &buf, pattern, !showSystem && !pattern, false,
761761
"n.nspname", "t.tgname", NULL,
762762
"pg_catalog.pg_table_is_visible(c.oid)");
763763

@@ -808,10 +808,10 @@ describeTableDetails(const char *pattern, bool verbose, bool showSystem)
808808
"FROM pg_catalog.pg_class c\n"
809809
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n");
810810

811-
if (!showSystem)
811+
if (!showSystem && !pattern)
812812
appendPQExpBuffer(&buf, " WHERE n.nspname <> 'pg_catalog'\n");
813813

814-
processSQLNamePattern(pset.db, &buf, pattern, !showSystem, false,
814+
processSQLNamePattern(pset.db, &buf, pattern, !showSystem && !pattern, false,
815815
"n.nspname", "c.relname", NULL,
816816
"pg_catalog.pg_table_is_visible(c.oid)");
817817

@@ -2008,12 +2008,12 @@ listTables(const char *tabtypes, const char *pattern, bool verbose, bool showSys
20082008
appendPQExpBuffer(&buf, "'i',");
20092009
if (showSeq)
20102010
appendPQExpBuffer(&buf, "'S',");
2011-
if (showSystem)
2011+
if (showSystem || pattern)
20122012
appendPQExpBuffer(&buf, "'s',"); /* was RELKIND_SPECIAL in <= 8.1 */
20132013
appendPQExpBuffer(&buf, "''"); /* dummy */
20142014
appendPQExpBuffer(&buf, ")\n");
20152015

2016-
if (!showSystem)
2016+
if (!showSystem && !pattern)
20172017
/* Exclude system and pg_toast objects, but show temp tables */
20182018
appendPQExpBuffer(&buf,
20192019
" AND n.nspname <> 'pg_catalog'\n"
@@ -2087,7 +2087,7 @@ listDomains(const char *pattern, bool showSystem)
20872087
gettext_noop("Modifier"),
20882088
gettext_noop("Check"));
20892089

2090-
if (!showSystem)
2090+
if (!showSystem && !pattern)
20912091
appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n");
20922092

20932093
processSQLNamePattern(pset.db, &buf, pattern, true, false,
@@ -2142,7 +2142,7 @@ listConversions(const char *pattern, bool showSystem)
21422142
gettext_noop("yes"), gettext_noop("no"),
21432143
gettext_noop("Default?"));
21442144

2145-
if (!showSystem)
2145+
if (!showSystem && !pattern)
21462146
appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n");
21472147

21482148
processSQLNamePattern(pset.db, &buf, pattern, true, false,

0 commit comments

Comments
 (0)