77 *
88 *
99 * IDENTIFICATION
10- * $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.106 1997/11/15 16:32:03 momjian Exp $
10+ * $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.107 1997/11/16 04:36:20 momjian Exp $
1111 *
1212 *-------------------------------------------------------------------------
1313 */
@@ -114,7 +114,8 @@ static void handleCopyOut(PGresult *res, bool quiet, FILE *copystream);
114114static void
115115handleCopyIn (PGresult * res ,const bool mustprompt ,
116116FILE * copystream );
117- static int tableList (PsqlSettings * pset ,bool deep_tablelist ,char info_type );
117+ static int tableList (PsqlSettings * pset ,bool deep_tablelist ,
118+ char info_type ,bool system_tables );
118119static int tableDesc (PsqlSettings * pset ,char * table ,FILE * fout );
119120static int objectDescription (PsqlSettings * pset ,char * object ,FILE * fout );
120121static int rightsList (PsqlSettings * pset );
@@ -223,6 +224,7 @@ slashUsage(PsqlSettings *pset)
223224fprintf (fout ," \\di -- list only indices\n" );
224225fprintf (fout ," \\do -- list operators\n" );
225226fprintf (fout ," \\ds -- list only sequences\n" );
227+ fprintf (fout ," \\dS -- list system tables and indexes\n" );
226228fprintf (fout ," \\dt -- list only tables\n" );
227229fprintf (fout ," \\dT -- list types\n" );
228230fprintf (fout ," \\e [<fname>] -- edit the current query buffer or <fname>\n" );
@@ -303,7 +305,8 @@ listAllDbs(PsqlSettings *pset)
303305 *
304306 */
305307int
306- tableList (PsqlSettings * pset ,bool deep_tablelist ,char info_type )
308+ tableList (PsqlSettings * pset ,bool deep_tablelist ,char info_type ,
309+ bool system_tables )
307310{
308311char listbuf [256 ];
309312int nColumns ;
@@ -347,7 +350,10 @@ tableList(PsqlSettings *pset, bool deep_tablelist, char info_type)
347350strcat (listbuf ,"WHERE ( relkind = 'r' OR relkind = 'i' OR relkind = 'S') " );
348351break ;
349352}
350- strcat (listbuf ," and relname !~ '^pg_'" );
353+ if (!system_tables )
354+ strcat (listbuf ," and relname !~ '^pg_'" );
355+ else
356+ strcat (listbuf ," and relname ~ '^pg_'" );
351357strcat (listbuf ," and relname !~ '^xin[vx][0-9]+'" );
352358
353359/*
@@ -1708,7 +1714,7 @@ HandleSlashCmds(PsqlSettings *pset,
17081714false, false,0 );
17091715else if (strncmp (cmd ,"di" ,2 )== 0 )
17101716/* only indices */
1711- tableList (pset , false,'i' );
1717+ tableList (pset , false,'i' , false );
17121718else if (strncmp (cmd ,"do" ,2 )== 0 )
17131719{
17141720/* operators */
@@ -1754,10 +1760,13 @@ HandleSlashCmds(PsqlSettings *pset,
17541760}
17551761else if (strncmp (cmd ,"ds" ,2 )== 0 )
17561762/* only sequences */
1757- tableList (pset , false,'S' );
1763+ tableList (pset , false,'S' , false);
1764+ else if (strncmp (cmd ,"dS" ,2 )== 0 )
1765+ /* system tables */
1766+ tableList (pset , false,'b' , true);
17581767else if (strncmp (cmd ,"dt" ,2 )== 0 )
17591768/* only tables */
1760- tableList (pset , false,'t' );
1769+ tableList (pset , false,'t' , false );
17611770else if (strncmp (cmd ,"dT" ,2 )== 0 )
17621771/* types */
17631772SendQuery (& success ,pset ,"\
@@ -1770,11 +1779,11 @@ HandleSlashCmds(PsqlSettings *pset,
17701779false, false,0 );
17711780else if (!optarg )
17721781/* show tables, sequences and indices */
1773- tableList (pset , false,'b' );
1782+ tableList (pset , false,'b' , false );
17741783else if (strcmp (optarg ,"*" )== 0 )
17751784{/* show everything */
1776- if (tableList (pset , false,'b' )== 0 )
1777- tableList (pset , true,'b' );
1785+ if (tableList (pset , false,'b' , false )== 0 )
1786+ tableList (pset , true,'b' , false );
17781787}
17791788else if (strncmp (cmd ,"d " ,2 )== 0 )
17801789/* describe the specified table */