提交 12fc3307 编写于 作者: B Bruce Momjian

New \dS psql command. initdb cleanup.

上级 1c32d285
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
# #
# #
# IDENTIFICATION # 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 ...@@ -346,10 +346,14 @@ fi
echo 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 "loading pg_description"
echo "copy pg_description from '$TEMPLATE_DESCR'" | postgres -F -Q -D$PGDATA template1 > /dev/null 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 "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 |\ echo "vacuum analyze" | postgres -F -Q -D$PGDATA template1 2>&1 > /dev/null |\
grep -v "^DEBUG:" grep -v "^DEBUG:"
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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); ...@@ -114,7 +114,8 @@ static void handleCopyOut(PGresult *res, bool quiet, FILE *copystream);
static void static void
handleCopyIn(PGresult *res, const bool mustprompt, handleCopyIn(PGresult *res, const bool mustprompt,
FILE *copystream); 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 tableDesc(PsqlSettings *pset, char *table, FILE *fout);
static int objectDescription(PsqlSettings *pset, char *object, FILE *fout); static int objectDescription(PsqlSettings *pset, char *object, FILE *fout);
static int rightsList(PsqlSettings *pset); static int rightsList(PsqlSettings *pset);
...@@ -223,6 +224,7 @@ slashUsage(PsqlSettings *pset) ...@@ -223,6 +224,7 @@ slashUsage(PsqlSettings *pset)
fprintf(fout, " \\di -- list only indices\n"); fprintf(fout, " \\di -- list only indices\n");
fprintf(fout, " \\do -- list operators\n"); fprintf(fout, " \\do -- list operators\n");
fprintf(fout, " \\ds -- list only sequences\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 only tables\n");
fprintf(fout, " \\dT -- list types\n"); fprintf(fout, " \\dT -- list types\n");
fprintf(fout, " \\e [<fname>] -- edit the current query buffer or <fname>\n"); fprintf(fout, " \\e [<fname>] -- edit the current query buffer or <fname>\n");
...@@ -303,7 +305,8 @@ listAllDbs(PsqlSettings *pset) ...@@ -303,7 +305,8 @@ listAllDbs(PsqlSettings *pset)
* *
*/ */
int 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]; char listbuf[256];
int nColumns; int nColumns;
...@@ -347,7 +350,10 @@ tableList(PsqlSettings *pset, bool deep_tablelist, char info_type) ...@@ -347,7 +350,10 @@ tableList(PsqlSettings *pset, bool deep_tablelist, char info_type)
strcat(listbuf, "WHERE ( relkind = 'r' OR relkind = 'i' OR relkind = 'S') "); strcat(listbuf, "WHERE ( relkind = 'r' OR relkind = 'i' OR relkind = 'S') ");
break; 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]+'"); strcat(listbuf, " and relname !~ '^xin[vx][0-9]+'");
/* /*
...@@ -1708,7 +1714,7 @@ HandleSlashCmds(PsqlSettings *pset, ...@@ -1708,7 +1714,7 @@ HandleSlashCmds(PsqlSettings *pset,
false, false, 0); false, false, 0);
else if (strncmp(cmd, "di", 2) == 0) else if (strncmp(cmd, "di", 2) == 0)
/* only indices */ /* only indices */
tableList(pset, false, 'i'); tableList(pset, false, 'i', false);
else if (strncmp(cmd, "do", 2) == 0) else if (strncmp(cmd, "do", 2) == 0)
{ {
/* operators */ /* operators */
...@@ -1754,10 +1760,13 @@ HandleSlashCmds(PsqlSettings *pset, ...@@ -1754,10 +1760,13 @@ HandleSlashCmds(PsqlSettings *pset,
} }
else if (strncmp(cmd, "ds", 2) == 0) else if (strncmp(cmd, "ds", 2) == 0)
/* only sequences */ /* 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) else if (strncmp(cmd, "dt", 2) == 0)
/* only tables */ /* only tables */
tableList(pset, false, 't'); tableList(pset, false, 't', false);
else if (strncmp(cmd, "dT", 2) == 0) else if (strncmp(cmd, "dT", 2) == 0)
/* types */ /* types */
SendQuery(&success, pset,"\ SendQuery(&success, pset,"\
...@@ -1770,11 +1779,11 @@ HandleSlashCmds(PsqlSettings *pset, ...@@ -1770,11 +1779,11 @@ HandleSlashCmds(PsqlSettings *pset,
false, false, 0); false, false, 0);
else if (!optarg) else if (!optarg)
/* show tables, sequences and indices */ /* show tables, sequences and indices */
tableList(pset, false, 'b'); tableList(pset, false, 'b', false);
else if (strcmp(optarg, "*") == 0) else if (strcmp(optarg, "*") == 0)
{ /* show everything */ { /* show everything */
if (tableList(pset, false, 'b') == 0) if (tableList(pset, false, 'b', false) == 0)
tableList(pset, true, 'b'); tableList(pset, true, 'b', false);
} }
else if (strncmp(cmd, "d ", 2) == 0) else if (strncmp(cmd, "d ", 2) == 0)
/* describe the specified table */ /* describe the specified table */
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * 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 * NOTES
* the genbki.sh script reads this file and generates .bki * the genbki.sh script reads this file and generates .bki
...@@ -226,19 +226,6 @@ DATA(insert OID = 0 ( 1262 cmin 29 0 4 -4 0 -1 t f i f f)); ...@@ -226,19 +226,6 @@ DATA(insert OID = 0 ( 1262 cmin 29 0 4 -4 0 -1 t f i f f));
DATA(insert OID = 0 ( 1262 xmax 28 0 4 -5 0 -1 f f i f f)); 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)); 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 * pg_proc
* ---------------- * ----------------
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * 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 * NOTES
* ``pg_relation'' is being replaced by ``pg_class''. currently * ``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 ...@@ -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(""); DESCR("");
DATA(insert OID = 1249 ( pg_attribute 75 PGUID 0 0 0 0 0 f f r n 16 0 0 0 f _null_ )); DATA(insert OID = 1249 ( pg_attribute 75 PGUID 0 0 0 0 0 f f r n 16 0 0 0 f _null_ ));
DESCR(""); 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_ )); DATA(insert OID = 1255 ( pg_proc 81 PGUID 0 0 0 0 0 f f r n 16 0 0 0 f _null_ ));
DESCR(""); DESCR("");
DATA(insert OID = 1259 ( pg_class 83 PGUID 0 0 0 0 0 f f r n 18 0 0 0 f _null_ )); 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 ...@@ -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(""); DESCR("");
#define RelOid_pg_type 1247 #define RelOid_pg_type 1247
#define RelOid_pg_description 1251
#define RelOid_pg_attribute 1249 #define RelOid_pg_attribute 1249
#define RelOid_pg_proc 1255 #define RelOid_pg_proc 1255
#define RelOid_pg_class 1259 #define RelOid_pg_class 1259
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * 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 * NOTES
* the genbki.sh script reads this file and generates .bki * the genbki.sh script reads this file and generates .bki
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
* typedef struct FormData_pg_description * typedef struct FormData_pg_description
* ---------------- * ----------------
*/ */
CATALOG(pg_description) BOOTSTRAP CATALOG(pg_description)
{ {
Oid objoid; Oid objoid;
text description; text description;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * 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 * NOTES
* the genbki.sh script reads this file and generates .bki * 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 _ ...@@ -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(""); DESCR("");
DATA(insert OID = 75 ( pg_attribute PGUID 1 1 t b t \054 1249 0 foo bar foo bar c _null_)); DATA(insert OID = 75 ( pg_attribute PGUID 1 1 t b t \054 1249 0 foo bar foo bar c _null_));
DESCR(""); 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_)); DATA(insert OID = 81 ( pg_proc PGUID 1 1 t b t \054 1255 0 foo bar foo bar c _null_));
DESCR(""); DESCR("");
DATA(insert OID = 83 ( pg_class PGUID 1 1 t b t \054 1259 0 foo bar foo bar c _null_)); DATA(insert OID = 83 ( pg_class PGUID 1 1 t b t \054 1259 0 foo bar foo bar c _null_));
......
.\" This is -*-nroff-*- .\" This is -*-nroff-*-
.\" XXX standard disclaimer belongs here.... .\" 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 .TH PSQL UNIX 1/20/96 PostgreSQL PostgreSQL
.SH NAME .SH NAME
psql \(em run the interactive query front-end psql \(em run the interactive query front-end
...@@ -304,6 +304,8 @@ List only indexes. ...@@ -304,6 +304,8 @@ List only indexes.
List operators. List operators.
.IP "\eds" .IP "\eds"
List only sequences. List only sequences.
.IP "\edS"
List system tables and indexes.
.IP "\edt" .IP "\edt"
List only tables. List only tables.
.IP "\edT" .IP "\edT"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册