Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit12fc330

Browse files
committed
New \dS psql command. initdb cleanup.
1 parent1c32d28 commit12fc330

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 template12>&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 template12>&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
staticvoid
115115
handleCopyIn(PGresult*res,constboolmustprompt,
116116
FILE*copystream);
117-
staticinttableList(PsqlSettings*pset,booldeep_tablelist,charinfo_type);
117+
staticinttableList(PsqlSettings*pset,booldeep_tablelist,
118+
charinfo_type,boolsystem_tables);
118119
staticinttableDesc(PsqlSettings*pset,char*table,FILE*fout);
119120
staticintobjectDescription(PsqlSettings*pset,char*object,FILE*fout);
120121
staticintrightsList(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,booldeep_tablelist,charinfo_type)
308+
tableList(PsqlSettings*pset,booldeep_tablelist,charinfo_type,
309+
boolsystem_tables)
307310
{
308311
charlistbuf[256];
309312
intnColumns;
@@ -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
elseif (strncmp(cmd,"di",2)==0)
17101716
/* only indices */
1711-
tableList(pset, false,'i');
1717+
tableList(pset, false,'i', false);
17121718
elseif (strncmp(cmd,"do",2)==0)
17131719
{
17141720
/* operators */
@@ -1754,10 +1760,13 @@ HandleSlashCmds(PsqlSettings *pset,
17541760
}
17551761
elseif (strncmp(cmd,"ds",2)==0)
17561762
/* only sequences */
1757-
tableList(pset, false,'S');
1763+
tableList(pset, false,'S', false);
1764+
elseif (strncmp(cmd,"dS",2)==0)
1765+
/* system tables */
1766+
tableList(pset, false,'b', true);
17581767
elseif (strncmp(cmd,"dt",2)==0)
17591768
/* only tables */
1760-
tableList(pset, false,'t');
1769+
tableList(pset, false,'t', false);
17611770
elseif (strncmp(cmd,"dT",2)==0)
17621771
/* types */
17631772
SendQuery(&success,pset,"\
@@ -1770,11 +1779,11 @@ HandleSlashCmds(PsqlSettings *pset,
17701779
false, false,0);
17711780
elseif (!optarg)
17721781
/* show tables, sequences and indices */
1773-
tableList(pset, false,'b');
1782+
tableList(pset, false,'b', false);
17741783
elseif (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
elseif (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 cmin29 0 4 -4 0 -1 t f i f f));
226226
DATA(insertOID=0 (1262xmax2804-50-1ffiff));
227227
DATA(insertOID=0 (1262cmax2904-60-1tfiff));
228228

229-
/* ----------------
230-
*pg_description
231-
* ----------------
232-
*/
233-
DATA(insertOID=0 (1251objoid260410-1tfiff));
234-
DATA(insertOID=0 (1251description250-120-1ffiff));
235-
DATA(insertOID=0 (1251ctid2706-10-1ffiff));
236-
DATA(insertOID=0 (1251oid2604-20-1tfiff));
237-
DATA(insertOID=0 (1251xmin2804-30-1ffiff));
238-
DATA(insertOID=0 (1251cmin2904-40-1tfiff));
239-
DATA(insertOID=0 (1251xmax2804-50-1ffiff));
240-
DATA(insertOID=0 (1251cmax2904-60-1tfiff));
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(insertOID=1249 (pg_attribute75PGUID00000ffrn16000f_null_ ));
134134
DESCR("");
135-
DATA(insertOID=1251 (pg_description76PGUID00000ftrn2000f_null_ ));
136-
DESCR("");
137135
DATA(insertOID=1255 (pg_proc81PGUID00000ffrn16000f_null_ ));
138136
DESCR("");
139137
DATA(insertOID=1259 (pg_class83PGUID00000ffrn18000f_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
#defineRelOid_pg_type1247
159-
#defineRelOid_pg_description1251
160157
#defineRelOid_pg_attribute1249
161158
#defineRelOid_pg_proc1255
162159
#defineRelOid_pg_class1259

‎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
Oidobjoid;
3838
textdescription;

‎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(insertOID=75 (pg_attributePGUID11tbt \05412490foobarfoobarc_null_));
212212
DESCR("");
213-
DATA(insertOID=76 (pg_descriptionPGUID11tbt \05412510foobarfoobarc_null_));
214-
DESCR("");
215213
DATA(insertOID=81 (pg_procPGUID11tbt \05412550foobarfoobarc_null_));
216214
DESCR("");
217215
DATA(insertOID=83 (pg_classPGUID11tbt \05412590foobarfoobarc_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)

[8]ページ先頭

©2009-2025 Movatter.jp