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

Commit5071ae2

Browse files
committed
Add pg_description table for info on tables, columns, operators, types, and aggregates. Modify psql with new \dd operator to access description
1 parent7e48d42 commit5071ae2

File tree

16 files changed

+1890
-51
lines changed

16 files changed

+1890
-51
lines changed

‎src/backend/Makefile

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#
3535
#
3636
# IDENTIFICATION
37-
# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.26 1997/09/20 16:08:24 thomas Exp $
37+
# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.27 1997/11/13 03:22:10 momjian Exp $
3838
#
3939
#-------------------------------------------------------------------------
4040

@@ -51,7 +51,8 @@ endif
5151

5252
OBJS =$(DIRS:%=%/SUBSYS.o)
5353

54-
all: postgres$(POSTGRES_IMP) global1.bki.source local1_template1.bki.source
54+
all: postgres$(POSTGRES_IMP) global1.bki.source local1_template1.bki.source\
55+
global1.description local1_template1.description
5556

5657
postgres:$(OBJS) ../utils/version.o
5758
$(CC) -o postgres$(OBJS) ../utils/version.o$(LDFLAGS)
@@ -64,10 +65,12 @@ $(DIRS:%=%.dir):
6465
../utils/version.o:
6566
$(MAKE) -C ../utils version.o
6667

67-
global1.bki.sourcelocal1_template1.bki.source: catalog/$@
68+
global1.bki.source local1_template1.bki.source \
69+
global1.descriptionlocal1_template1.description: catalog/$@
6870
cp catalog/$@.
6971

70-
catalog/global1.bki.sourcecatalog/local1_template1.bki.source:
72+
catalog/global1.bki.source catalog/local1_template1.bki.source \
73+
catalog/global1.descriptioncatalog/local1_template1.description:
7174
$(MAKE) -C catalog$@
7275

7376
# The postgres.o target is needed by the rule in Makefile.global that
@@ -91,7 +94,8 @@ fmgr.h:
9194
#############################################################################
9295
clean:
9396
rm -f postgres$(POSTGRES_IMP) fmgr.h parse.h\
94-
global1.bki.source local1_template1.bki.source
97+
global1.bki.source local1_template1.bki.source\
98+
global1.description local1_template1.description
9599
foriin$(DIRS);do$(MAKE) -C$$i clean PORTNAME=$(PORTNAME);done
96100

97101
.DEFAULT:
@@ -115,6 +119,7 @@ clean:
115119

116120
install:$(LIBDIR)$(BINDIR)$(HEADERDIR) postgres$(POSTGRES_IMP) fmgr.h\
117121
global1.bki.source local1_template1.bki.source \
122+
global1.description local1_template1.description \
118123
libpq/pg_hba.conf.sample optimizer/geqo/pg_geqo.sample
119124

120125
$(INSTALL) $(INSTL_EXE_OPTS) postgres $(BINDIR)/postgres
@@ -126,8 +131,12 @@ endif
126131
$(INSTALL) $(INSTLOPTS) fmgr.h $(HEADERDIR)/fmgr.h
127132
$(INSTALL) $(INSTLOPTS) global1.bki.source \
128133
$(LIBDIR)/global1.bki.source
134+
$(INSTALL) $(INSTLOPTS) global1.description \
135+
$(LIBDIR)/global1.description
129136
$(INSTALL) $(INSTLOPTS) local1_template1.bki.source \
130137
$(LIBDIR)/local1_template1.bki.source
138+
$(INSTALL) $(INSTLOPTS) local1_template1.description \
139+
$(LIBDIR)/local1_template1.description
131140
$(INSTALL) $(INSTLOPTS) libpq/pg_hba.conf.sample \
132141
$(LIBDIR)/pg_hba.conf.sample
133142
$(INSTALL) $(INSTLOPTS) optimizer/geqo/pg_geqo.sample \

‎src/backend/catalog/Makefile

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Makefile for catalog
55
#
66
# IDENTIFICATION
7-
# $Header: /cvsroot/pgsql/src/backend/catalog/Makefile,v 1.3 1997/11/02 15:24:52 vadim Exp $
7+
# $Header: /cvsroot/pgsql/src/backend/catalog/Makefile,v 1.4 1997/11/13 03:22:18 momjian Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -20,7 +20,8 @@ CFLAGS+=$(INCLUDE_OPT)
2020
OBJS = catalog.o heap.o index.o indexing.o\
2121
pg_aggregate.o pg_operator.o pg_proc.o pg_type.o
2222

23-
all: SUBSYS.o global1.bki.source local1_template1.bki.source
23+
all: SUBSYS.o global1.bki.source local1_template1.bki.source\
24+
global1.description local1_template1.description
2425

2526
SUBSYS.o:$(OBJS)
2627
$(LD) -r -o SUBSYS.o$(OBJS)
@@ -39,21 +40,21 @@ LOCALBKI_SRCS= $(addprefix ../../include/catalog/, \
3940
pg_operator.h pg_opclass.h pg_am.h pg_amop.h pg_amproc.h \
4041
pg_language.h pg_parg.h \
4142
pg_aggregate.h pg_ipl.h pg_inheritproc.h \
42-
pg_rewrite.h pg_listener.h indexing.h \
43+
pg_rewrite.h pg_listener.hpg_description.hindexing.h \
4344
)
4445

4546
global1.bki.source:$(GENBKI)$(GLOBALBKI_SRCS)
46-
sh$(SHOPTS)$(GENBKI)$(BKIOPTS)$(GLOBALBKI_SRCS)>$@
47+
sh$(SHOPTS)$(GENBKI)$(BKIOPTS)$(GLOBALBKI_SRCS)>$@2>global1.description
4748

4849
local1_template1.bki.source:$(GENBKI)$(LOCALBKI_SRCS)
49-
sh$(SHOPTS)$(GENBKI)$(BKIOPTS)$(LOCALBKI_SRCS)>$@
50+
sh$(SHOPTS)$(GENBKI)$(BKIOPTS)$(LOCALBKI_SRCS)>$@2>local1_template1.description
5051

5152
dependdep:
5253
$(CC) -MM$(INCLUDE_OPT)*.c>depend
5354

5455
clean:
55-
rm -f SUBSYS.o$(OBJS) global1.bki.source local1_template1.bki.source
56-
56+
rm -f SUBSYS.o$(OBJS) global1.bki.source local1_template1.bki.source\
57+
global1.description local1_template1.description
5758

5859
ifeq (depend,$(wildcard depend))
5960
include depend

‎src/backend/catalog/genbki.sh

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,18 @@
1010
#
1111
#
1212
# IDENTIFICATION
13-
# $Header: /cvsroot/pgsql/src/backend/catalog/Attic/genbki.sh,v 1.8 1997/09/06 18:27:11 momjian Exp $
13+
# $Header: /cvsroot/pgsql/src/backend/catalog/Attic/genbki.sh,v 1.9 1997/11/13 03:22:20 momjian Exp $
1414
#
1515
# NOTES
1616
# non-essential whitespace is removed from the generated file.
1717
# if this is ever a problem, then the sed script at the very
1818
# end can be changed into another awk script or something smarter..
1919
#
2020
#-------------------------------------------------------------------------
21+
trap"rm -f /tmp/genbki.tmp" 0 1 2 3 15
22+
23+
# make sure it is empty
24+
>/tmp/genbki.tmp
2125

2226
PATH=$PATH:/lib:/usr/ccs/lib# to find cpp
2327
BKIOPTS=''
@@ -118,6 +122,27 @@ raw == 1 { print; next; }
118122
/^DATA\(/ {
119123
data = substr($0, 6, length($0) - 6);
120124
print data;
125+
nf = 1;
126+
oid = 0;
127+
while (nf <= NF-3)
128+
{
129+
if ($nf == "OID" && $(nf+1) == "=")
130+
{
131+
oid = $(nf+2);
132+
break;
133+
}
134+
nf++;
135+
}
136+
next;
137+
}
138+
139+
/^DESCR\(/ {
140+
if (oid != 0)
141+
{
142+
data = substr($0, 8, length($0) - 9);
143+
if (data != "")
144+
printf "%d%s\n", oid, data >> "/tmp/genbki.tmp";
145+
}
121146
next;
122147
}
123148
@@ -235,6 +260,9 @@ cpp $BKIOPTS | \
235260
sed -e'/^[ ]*$/d' \
236261
-e's/[ ][ ]*/ /g'
237262

263+
# send pg_description file contents to standard error
264+
cat /tmp/genbki.tmp1>&2
265+
238266
# ----------------
239267
#all done
240268
# ----------------

‎src/bin/initdb/initdb.sh

Lines changed: 11 additions & 6 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.24 1997/02/19 13:11:58 scrappy Exp $
29+
# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.25 1997/11/13 03:22:34 momjian Exp $
3030
#
3131
#-------------------------------------------------------------------------
3232

@@ -152,6 +152,8 @@ fi
152152

153153
TEMPLATE=$PGLIB/local1_template1.bki.source
154154
GLOBAL=$PGLIB/global1.bki.source
155+
TEMPLATE_DESCR=$PGLIB/local1_template1.description
156+
GLOBAL_DESCR=$PGLIB/global1.description
155157
PG_HBA_SAMPLE=$PGLIB/pg_hba.conf.sample
156158
PG_GEQO_SAMPLE=$PGLIB/pg_geqo.sample
157159

@@ -344,8 +346,11 @@ fi
344346

345347
echo
346348

347-
if [$debug-eq 0 ];then
348-
echo"vacuuming template1"
349-
echo"vacuum"| postgres -F -Q -D$PGDATA template12>&1> /dev/null|\
350-
grep -v"^DEBUG:"
351-
fi
349+
echo"vacuuming template1"
350+
echo"vacuum"| postgres -F -Q -D$PGDATA template12>&1> /dev/null|\
351+
grep -v"^DEBUG:"
352+
353+
echo"loading pg_description"
354+
echo"copy pg_description from '$TEMPLATE_DESCR'"| postgres -F -Q -D$PGDATA template1> /dev/null
355+
echo"copy pg_description from '$GLOBAL_DESCR'"| postgres -F -Q -D$PGDATA template1> /dev/null
356+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp