Skip to content

Commit 12fc330

Browse files
committed
New \dS psql command. initdb cleanup.
1 parent 1c32d28 commit 12fc330

File tree

7 files changed

+34
-37
lines changed

7 files changed

+34
-37
lines changed

src/bin/initdb/initdb.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#
2727
#
2828
# IDENTIFICATION
29-
# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.28 1997/11/15 20:57:30 momjian Exp $
29+
# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.29 1997/11/16 04:36:14 momjian Exp $
3030
#
3131
#-------------------------------------------------------------------------
3232

@@ -346,10 +346,14 @@ fi
346346

347347
echo
348348

349+
# If the COPY is first, the VACUUM generates an error, so we vacuum first
350+
echo "vacuuming template1"
351+
echo "vacuum" | postgres -F -Q -D$PGDATA template1 2>&1 > /dev/null |\
352+
grep -v "^DEBUG:"
353+
349354
echo "loading pg_description"
350355
echo "copy pg_description from '$TEMPLATE_DESCR'" | postgres -F -Q -D$PGDATA template1 > /dev/null
351356
echo "copy pg_description from '$GLOBAL_DESCR'" | postgres -F -Q -D$PGDATA template1 > /dev/null
352-
353-
echo "vacuuming template1"
354357
echo "vacuum analyze" | postgres -F -Q -D$PGDATA template1 2>&1 > /dev/null |\
355358
grep -v "^DEBUG:"
359+

src/bin/psql/psql.c

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
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);
114114
static void
115115
handleCopyIn(PGresult *res, const bool mustprompt,
116116
FILE *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);
118119
static int tableDesc(PsqlSettings *pset, char *table, FILE *fout);
119120
static int objectDescription(PsqlSettings *pset, char *object, FILE *fout);
120121
static int rightsList(PsqlSettings *pset);
@@ -223,6 +224,7 @@ slashUsage(PsqlSettings *pset)
223224
fprintf(fout, " \\di -- list only indices\n");
224225
fprintf(fout, " \\do -- list operators\n");
225226
fprintf(fout, " \\ds -- list only sequences\n");
227+
fprintf(fout, " \\dS -- list system tables and indexes\n");
226228
fprintf(fout, " \\dt -- list only tables\n");
227229
fprintf(fout, " \\dT -- list types\n");
228230
fprintf(fout, " \\e [<fname>] -- edit the current query buffer or <fname>\n");
@@ -303,7 +305,8 @@ listAllDbs(PsqlSettings *pset)
303305
*
304306
*/
305307
int
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
{
308311
char listbuf[256];
309312
int nColumns;
@@ -347,7 +350,10 @@ tableList(PsqlSettings *pset, bool deep_tablelist, char info_type)
347350
strcat(listbuf, "WHERE ( relkind = 'r' OR relkind = 'i' OR relkind = 'S') ");
348351
break;
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_'");
351357
strcat(listbuf, " and relname !~ '^xin[vx][0-9]+'");
352358

353359
/*
@@ -1708,7 +1714,7 @@ HandleSlashCmds(PsqlSettings *pset,
17081714
false, false, 0);
17091715
else if (strncmp(cmd, "di", 2) == 0)
17101716
/* only indices */
1711-
tableList(pset, false, 'i');
1717+
tableList(pset, false, 'i', false);
17121718
else if (strncmp(cmd, "do", 2) == 0)
17131719
{
17141720
/* operators */
@@ -1754,10 +1760,13 @@ HandleSlashCmds(PsqlSettings *pset,
17541760
}
17551761
else 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);
17581767
else if (strncmp(cmd, "dt", 2) == 0)
17591768
/* only tables */
1760-
tableList(pset, false, 't');
1769+
tableList(pset, false, 't', false);
17611770
else if (strncmp(cmd, "dT", 2) == 0)
17621771
/* types */
17631772
SendQuery(&success, pset,"\
@@ -1770,11 +1779,11 @@ HandleSlashCmds(PsqlSettings *pset,
17701779
false, false, 0);
17711780
else if (!optarg)
17721781
/* show tables, sequences and indices */
1773-
tableList(pset, false, 'b');
1782+
tableList(pset, false, 'b', false);
17741783
else 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
}
17791788
else if (strncmp(cmd, "d ", 2) == 0)
17801789
/* describe the specified table */

src/include/catalog/pg_attribute.h

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: pg_attribute.h,v 1.18 1997/11/15 20:57:40 momjian Exp $
10+
* $Id: pg_attribute.h,v 1.19 1997/11/16 04:36:32 momjian Exp $
1111
*
1212
* NOTES
1313
* 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));
226226
DATA(insert OID = 0 ( 1262 xmax 28 0 4 -5 0 -1 f f i f f));
227227
DATA(insert OID = 0 ( 1262 cmax 29 0 4 -6 0 -1 t f i f f));
228228

229-
/* ----------------
230-
* pg_description
231-
* ----------------
232-
*/
233-
DATA(insert OID = 0 ( 1251 objoid 26 0 4 1 0 -1 t f i f f));
234-
DATA(insert OID = 0 ( 1251 description 25 0 -1 2 0 -1 f f i f f));
235-
DATA(insert OID = 0 ( 1251 ctid 27 0 6 -1 0 -1 f f i f f));
236-
DATA(insert OID = 0 ( 1251 oid 26 0 4 -2 0 -1 t f i f f));
237-
DATA(insert OID = 0 ( 1251 xmin 28 0 4 -3 0 -1 f f i f f));
238-
DATA(insert OID = 0 ( 1251 cmin 29 0 4 -4 0 -1 t f i f f));
239-
DATA(insert OID = 0 ( 1251 xmax 28 0 4 -5 0 -1 f f i f f));
240-
DATA(insert OID = 0 ( 1251 cmax 29 0 4 -6 0 -1 t f i f f));
241-
242229
/* ----------------
243230
* pg_proc
244231
* ----------------

src/include/catalog/pg_class.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: pg_class.h,v 1.14 1997/11/15 20:57:41 momjian Exp $
10+
* $Id: pg_class.h,v 1.15 1997/11/16 04:36:38 momjian Exp $
1111
*
1212
* NOTES
1313
* ``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
132132
DESCR("");
133133
DATA(insert OID = 1249 ( pg_attribute 75 PGUID 0 0 0 0 0 f f r n 16 0 0 0 f _null_ ));
134134
DESCR("");
135-
DATA(insert OID = 1251 ( pg_description 76 PGUID 0 0 0 0 0 f t r n 2 0 0 0 f _null_ ));
136-
DESCR("");
137135
DATA(insert OID = 1255 ( pg_proc 81 PGUID 0 0 0 0 0 f f r n 16 0 0 0 f _null_ ));
138136
DESCR("");
139137
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
156154
DESCR("");
157155

158156
#define RelOid_pg_type 1247
159-
#define RelOid_pg_description 1251
160157
#define RelOid_pg_attribute 1249
161158
#define RelOid_pg_proc 1255
162159
#define RelOid_pg_class 1259

src/include/catalog/pg_description.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: pg_description.h,v 1.3 1997/11/15 20:57:48 momjian Exp $
9+
* $Id: pg_description.h,v 1.4 1997/11/16 04:36:41 momjian Exp $
1010
*
1111
* NOTES
1212
* the genbki.sh script reads this file and generates .bki
@@ -32,7 +32,7 @@
3232
* typedef struct FormData_pg_description
3333
* ----------------
3434
*/
35-
CATALOG(pg_description) BOOTSTRAP
35+
CATALOG(pg_description)
3636
{
3737
Oid objoid;
3838
text description;

src/include/catalog/pg_type.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: pg_type.h,v 1.22 1997/11/15 20:58:05 momjian Exp $
10+
* $Id: pg_type.h,v 1.23 1997/11/16 04:36:43 momjian Exp $
1111
*
1212
* NOTES
1313
* 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 _
210210
DESCR("");
211211
DATA(insert OID = 75 ( pg_attribute PGUID 1 1 t b t \054 1249 0 foo bar foo bar c _null_));
212212
DESCR("");
213-
DATA(insert OID = 76 ( pg_description PGUID 1 1 t b t \054 1251 0 foo bar foo bar c _null_));
214-
DESCR("");
215213
DATA(insert OID = 81 ( pg_proc PGUID 1 1 t b t \054 1255 0 foo bar foo bar c _null_));
216214
DESCR("");
217215
DATA(insert OID = 83 ( pg_class PGUID 1 1 t b t \054 1259 0 foo bar foo bar c _null_));

src/man/psql.1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.\" This is -*-nroff-*-
22
.\" XXX standard disclaimer belongs here....
3-
.\" $Header: /cvsroot/pgsql/src/man/Attic/psql.1,v 1.17 1997/11/15 16:32:25 momjian Exp $
3+
.\" $Header: /cvsroot/pgsql/src/man/Attic/psql.1,v 1.18 1997/11/16 04:36:52 momjian Exp $
44
.TH PSQL UNIX 1/20/96 PostgreSQL PostgreSQL
55
.SH NAME
66
psql \(em run the interactive query front-end
@@ -304,6 +304,8 @@ List only indexes.
304304
List operators.
305305
.IP "\eds"
306306
List only sequences.
307+
.IP "\edS"
308+
List system tables and indexes.
307309
.IP "\edt"
308310
List only tables.
309311
.IP "\edT"

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy