OSDN Git Service

New \dS psql command. initdb cleanup.
authorBruce Momjian <bruce@momjian.us>
Sun, 16 Nov 1997 04:36:52 +0000 (04:36 +0000)
committerBruce Momjian <bruce@momjian.us>
Sun, 16 Nov 1997 04:36:52 +0000 (04:36 +0000)
src/bin/initdb/initdb.sh
src/bin/psql/psql.c
src/include/catalog/pg_attribute.h
src/include/catalog/pg_class.h
src/include/catalog/pg_description.h
src/include/catalog/pg_type.h
src/man/psql.1

index 82744d9..6d6456f 100644 (file)
@@ -26,7 +26,7 @@
 #
 #
 # IDENTIFICATION
-#    $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.28 1997/11/15 20:57:30 momjian Exp $
+#    $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.29 1997/11/16 04:36:14 momjian Exp $
 #
 #-------------------------------------------------------------------------
 
@@ -346,10 +346,14 @@ fi
 
 echo
 
+# If the COPY is first, the VACUUM generates an error, so we vacuum first
+echo "vacuuming template1"
+echo "vacuum" | postgres -F -Q -D$PGDATA template1 2>&1 > /dev/null |\
+       grep -v "^DEBUG:"
+
 echo "loading pg_description"
 echo "copy pg_description from '$TEMPLATE_DESCR'" | postgres -F -Q -D$PGDATA template1 > /dev/null
 echo "copy pg_description from '$GLOBAL_DESCR'" | postgres -F -Q -D$PGDATA template1 > /dev/null
-
-echo "vacuuming template1"
 echo "vacuum analyze" | postgres -F -Q -D$PGDATA template1 2>&1 > /dev/null |\
        grep -v "^DEBUG:"
+
index e214428..089213b 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.106 1997/11/15 16:32:03 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.107 1997/11/16 04:36:20 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -114,7 +114,8 @@ static void handleCopyOut(PGresult *res, bool quiet, FILE *copystream);
 static void
 handleCopyIn(PGresult *res, const bool mustprompt,
                         FILE *copystream);
-static int     tableList(PsqlSettings *pset, bool deep_tablelist, char info_type);
+static int     tableList(PsqlSettings *pset, bool deep_tablelist,
+                               char info_type, bool system_tables);
 static int     tableDesc(PsqlSettings *pset, char *table, FILE *fout);
 static int     objectDescription(PsqlSettings *pset, char *object, FILE *fout);
 static int     rightsList(PsqlSettings *pset);
@@ -223,6 +224,7 @@ slashUsage(PsqlSettings *pset)
        fprintf(fout, " \\di          -- list only indices\n");
        fprintf(fout, " \\do          -- list operators\n");
        fprintf(fout, " \\ds          -- list only sequences\n");
+       fprintf(fout, " \\dS          -- list system tables and indexes\n");
        fprintf(fout, " \\dt          -- list only tables\n");
        fprintf(fout, " \\dT          -- list types\n");
        fprintf(fout, " \\e [<fname>] -- edit the current query buffer or <fname>\n");
@@ -303,7 +305,8 @@ listAllDbs(PsqlSettings *pset)
  *
  */
 int
-tableList(PsqlSettings *pset, bool deep_tablelist, char info_type)
+tableList(PsqlSettings *pset, bool deep_tablelist, char info_type,
+       bool system_tables)
 {
        char            listbuf[256];
        int                     nColumns;
@@ -347,7 +350,10 @@ tableList(PsqlSettings *pset, bool deep_tablelist, char info_type)
                        strcat(listbuf, "WHERE ( relkind = 'r' OR relkind = 'i' OR relkind = 'S') ");
                        break;
        }
-       strcat(listbuf, "  and relname !~ '^pg_'");
+       if (!system_tables)
+               strcat(listbuf, "  and relname !~ '^pg_'");
+       else
+               strcat(listbuf, "  and relname ~ '^pg_'");
        strcat(listbuf, "  and relname !~ '^xin[vx][0-9]+'");
 
        /*
@@ -1708,7 +1714,7 @@ HandleSlashCmds(PsqlSettings *pset,
                                        false, false, 0);
                        else if (strncmp(cmd, "di", 2) == 0)
                                                                /* only indices */
-                               tableList(pset, false, 'i');
+                               tableList(pset, false, 'i', false);
                        else if (strncmp(cmd, "do", 2) == 0)
                        {
                                                                /* operators */
@@ -1754,10 +1760,13 @@ HandleSlashCmds(PsqlSettings *pset,
                        }
                        else if (strncmp(cmd, "ds", 2) == 0)
                                                                /* only sequences */
-                               tableList(pset, false, 'S');
+                               tableList(pset, false, 'S', false);
+                       else if (strncmp(cmd, "dS", 2) == 0)
+                                                               /* system tables */
+                               tableList(pset, false, 'b', true);
                        else if (strncmp(cmd, "dt", 2) == 0)
                                                                /* only tables */
-                               tableList(pset, false, 't');
+                               tableList(pset, false, 't', false);
                        else if (strncmp(cmd, "dT", 2) == 0)
                                                                /* types */
                                SendQuery(&success, pset,"\
@@ -1770,11 +1779,11 @@ HandleSlashCmds(PsqlSettings *pset,
                                        false, false, 0);
                        else if (!optarg)
                                                                /* show tables, sequences and indices */
-                               tableList(pset, false, 'b');
+                               tableList(pset, false, 'b', false);
                        else if (strcmp(optarg, "*") == 0)
                        {                                       /* show everything */
-                               if (tableList(pset, false, 'b') == 0)
-                                       tableList(pset, true, 'b');
+                               if (tableList(pset, false, 'b', false) == 0)
+                                       tableList(pset, true, 'b', false);
                        }
                        else if (strncmp(cmd, "d ", 2) == 0)
                                                                /* describe the specified table */
index a3e92bf..b5249ad 100644 (file)
@@ -7,7 +7,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_attribute.h,v 1.18 1997/11/15 20:57:40 momjian Exp $
+ * $Id: pg_attribute.h,v 1.19 1997/11/16 04:36:32 momjian Exp $
  *
  * NOTES
  *       the genbki.sh script reads this file and generates .bki
@@ -227,19 +227,6 @@ DATA(insert OID = 0 ( 1262 xmax                            28 0  4  -5 0 -1 f f i f f));
 DATA(insert OID = 0 ( 1262 cmax                                29 0  4  -6 0 -1 t f i f f));
 
 /* ----------------
- *             pg_description
- * ----------------
- */
-DATA(insert OID = 0 ( 1251 objoid                      26 0  4   1 0 -1 t f i f f));
-DATA(insert OID = 0 ( 1251 description         25 0 -1   2 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1251 ctid                                27 0  6  -1 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1251 oid                         26 0  4  -2 0 -1 t f i f f));
-DATA(insert OID = 0 ( 1251 xmin                                28 0  4  -3 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1251 cmin                                29 0  4  -4 0 -1 t f i f f));
-DATA(insert OID = 0 ( 1251 xmax                                28 0  4  -5 0 -1 f f i f f));
-DATA(insert OID = 0 ( 1251 cmax                                29 0  4  -6 0 -1 t f i f f));
-
-/* ----------------
  *             pg_proc
  * ----------------
  */
index 7354b1c..bcc8b86 100644 (file)
@@ -7,7 +7,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_class.h,v 1.14 1997/11/15 20:57:41 momjian Exp $
+ * $Id: pg_class.h,v 1.15 1997/11/16 04:36:38 momjian Exp $
  *
  * NOTES
  *       ``pg_relation'' is being replaced by ``pg_class''.  currently
@@ -132,8 +132,6 @@ DATA(insert OID = 1247 (  pg_type 71                  PGUID 0 0 0 0 0 f f r n 16 0 0 0 f _null
 DESCR("");
 DATA(insert OID = 1249 (  pg_attribute 75        PGUID 0 0 0 0 0 f f r n 16 0 0 0 f _null_ ));
 DESCR("");
-DATA(insert OID = 1251 (  pg_description 76      PGUID 0 0 0 0 0 f t r n 2 0 0 0 f _null_ ));
-DESCR("");
 DATA(insert OID = 1255 (  pg_proc 81             PGUID 0 0 0 0 0 f f r n 16 0 0 0 f _null_ ));
 DESCR("");
 DATA(insert OID = 1259 (  pg_class 83            PGUID 0 0 0 0 0 f f r n 18 0 0 0 f _null_ ));
@@ -156,7 +154,6 @@ DATA(insert OID = 1219 (  pg_trigger 111      PGUID 0 0 0 0 0 t t r n 7 0 0 0 f _nu
 DESCR("");
 
 #define RelOid_pg_type                 1247
-#define RelOid_pg_description  1251
 #define RelOid_pg_attribute            1249
 #define RelOid_pg_proc                 1255
 #define RelOid_pg_class                        1259
index bc8df53..5882eeb 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_description.h,v 1.3 1997/11/15 20:57:48 momjian Exp $
+ * $Id: pg_description.h,v 1.4 1997/11/16 04:36:41 momjian Exp $
  *
  * NOTES
  *             the genbki.sh script reads this file and generates .bki
@@ -32,7 +32,7 @@
  *             typedef struct FormData_pg_description
  * ----------------
  */
-CATALOG(pg_description) BOOTSTRAP
+CATALOG(pg_description)
 {
        Oid                     objoid;
        text            description;
index c7d8a65..57763cd 100644 (file)
@@ -7,7 +7,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_type.h,v 1.22 1997/11/15 20:58:05 momjian Exp $
+ * $Id: pg_type.h,v 1.23 1997/11/16 04:36:43 momjian Exp $
  *
  * NOTES
  *       the genbki.sh script reads this file and generates .bki
@@ -210,8 +210,6 @@ DATA(insert OID = 71 (      pg_type          PGUID 1 1 t b t \054 1247 0 foo bar foo bar c _
 DESCR("");
 DATA(insert OID = 75 ( pg_attribute PGUID 1 1 t b t \054 1249 0 foo bar foo bar c _null_));
 DESCR("");
-DATA(insert OID = 76 ( pg_description   PGUID 1 1 t b t \054 1251 0 foo bar foo bar c _null_));
-DESCR("");
 DATA(insert OID = 81 ( pg_proc          PGUID 1 1 t b t \054 1255 0 foo bar foo bar c _null_));
 DESCR("");
 DATA(insert OID = 83 ( pg_class         PGUID 1 1 t b t \054 1259 0 foo bar foo bar c _null_));
index e104512..8569f5d 100644 (file)
@@ -1,6 +1,6 @@
 .\" This is -*-nroff-*-
 .\" XXX standard disclaimer belongs here....
-.\" $Header: /cvsroot/pgsql/src/man/Attic/psql.1,v 1.17 1997/11/15 16:32:25 momjian Exp $
+.\" $Header: /cvsroot/pgsql/src/man/Attic/psql.1,v 1.18 1997/11/16 04:36:52 momjian Exp $
 .TH PSQL UNIX 1/20/96 PostgreSQL PostgreSQL
 .SH NAME
 psql \(em run the interactive query front-end
@@ -304,6 +304,8 @@ List only indexes.
 List operators.
 .IP "\eds"
 List only sequences.
+.IP "\edS"
+List system tables and indexes.
 .IP "\edt"
 List only tables.
 .IP "\edT"