1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-10 17:42:29 +03:00

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

This commit is contained in:
Bruce Momjian
1997-11-13 03:23:18 +00:00
parent 7e48d427c8
commit 5071ae2972
16 changed files with 1890 additions and 51 deletions

View File

@@ -34,7 +34,7 @@
#
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.26 1997/09/20 16:08:24 thomas Exp $
# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.27 1997/11/13 03:22:10 momjian Exp $
#
#-------------------------------------------------------------------------
@@ -51,7 +51,8 @@ endif
OBJS = $(DIRS:%=%/SUBSYS.o)
all: postgres $(POSTGRES_IMP) global1.bki.source local1_template1.bki.source
all: postgres $(POSTGRES_IMP) global1.bki.source local1_template1.bki.source \
global1.description local1_template1.description
postgres: $(OBJS) ../utils/version.o
$(CC) -o postgres $(OBJS) ../utils/version.o $(LDFLAGS)
@@ -64,10 +65,12 @@ $(DIRS:%=%.dir):
../utils/version.o:
$(MAKE) -C ../utils version.o
global1.bki.source local1_template1.bki.source: catalog/$@
global1.bki.source local1_template1.bki.source \
global1.description local1_template1.description: catalog/$@
cp catalog/$@ .
catalog/global1.bki.source catalog/local1_template1.bki.source:
catalog/global1.bki.source catalog/local1_template1.bki.source \
catalog/global1.description catalog/local1_template1.description:
$(MAKE) -C catalog $@
# The postgres.o target is needed by the rule in Makefile.global that
@@ -91,7 +94,8 @@ fmgr.h:
#############################################################################
clean:
rm -f postgres $(POSTGRES_IMP) fmgr.h parse.h \
global1.bki.source local1_template1.bki.source
global1.bki.source local1_template1.bki.source \
global1.description local1_template1.description
for i in $(DIRS); do $(MAKE) -C $$i clean PORTNAME=$(PORTNAME); done
.DEFAULT:
@@ -115,6 +119,7 @@ clean:
install: $(LIBDIR) $(BINDIR) $(HEADERDIR) postgres $(POSTGRES_IMP) fmgr.h\
global1.bki.source local1_template1.bki.source \
global1.description local1_template1.description \
libpq/pg_hba.conf.sample optimizer/geqo/pg_geqo.sample
$(INSTALL) $(INSTL_EXE_OPTS) postgres $(BINDIR)/postgres
@@ -126,8 +131,12 @@ endif
$(INSTALL) $(INSTLOPTS) fmgr.h $(HEADERDIR)/fmgr.h
$(INSTALL) $(INSTLOPTS) global1.bki.source \
$(LIBDIR)/global1.bki.source
$(INSTALL) $(INSTLOPTS) global1.description \
$(LIBDIR)/global1.description
$(INSTALL) $(INSTLOPTS) local1_template1.bki.source \
$(LIBDIR)/local1_template1.bki.source
$(INSTALL) $(INSTLOPTS) local1_template1.description \
$(LIBDIR)/local1_template1.description
$(INSTALL) $(INSTLOPTS) libpq/pg_hba.conf.sample \
$(LIBDIR)/pg_hba.conf.sample
$(INSTALL) $(INSTLOPTS) optimizer/geqo/pg_geqo.sample \

View File

@@ -4,7 +4,7 @@
# Makefile for catalog
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/backend/catalog/Makefile,v 1.3 1997/11/02 15:24:52 vadim Exp $
# $Header: /cvsroot/pgsql/src/backend/catalog/Makefile,v 1.4 1997/11/13 03:22:18 momjian Exp $
#
#-------------------------------------------------------------------------
@@ -20,7 +20,8 @@ CFLAGS+=$(INCLUDE_OPT)
OBJS = catalog.o heap.o index.o indexing.o \
pg_aggregate.o pg_operator.o pg_proc.o pg_type.o
all: SUBSYS.o global1.bki.source local1_template1.bki.source
all: SUBSYS.o global1.bki.source local1_template1.bki.source \
global1.description local1_template1.description
SUBSYS.o: $(OBJS)
$(LD) -r -o SUBSYS.o $(OBJS)
@@ -39,21 +40,21 @@ LOCALBKI_SRCS= $(addprefix ../../include/catalog/, \
pg_operator.h pg_opclass.h pg_am.h pg_amop.h pg_amproc.h \
pg_language.h pg_parg.h \
pg_aggregate.h pg_ipl.h pg_inheritproc.h \
pg_rewrite.h pg_listener.h indexing.h \
pg_rewrite.h pg_listener.h pg_description.h indexing.h \
)
global1.bki.source: $(GENBKI) $(GLOBALBKI_SRCS)
sh $(SHOPTS) $(GENBKI) $(BKIOPTS) $(GLOBALBKI_SRCS) > $@
sh $(SHOPTS) $(GENBKI) $(BKIOPTS) $(GLOBALBKI_SRCS) > $@ 2>global1.description
local1_template1.bki.source: $(GENBKI) $(LOCALBKI_SRCS)
sh $(SHOPTS) $(GENBKI) $(BKIOPTS) $(LOCALBKI_SRCS) > $@
sh $(SHOPTS) $(GENBKI) $(BKIOPTS) $(LOCALBKI_SRCS) > $@ 2>local1_template1.description
depend dep:
$(CC) -MM $(INCLUDE_OPT) *.c >depend
clean:
rm -f SUBSYS.o $(OBJS) global1.bki.source local1_template1.bki.source
rm -f SUBSYS.o $(OBJS) global1.bki.source local1_template1.bki.source \
global1.description local1_template1.description
ifeq (depend,$(wildcard depend))
include depend

View File

@@ -10,7 +10,7 @@
#
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/backend/catalog/Attic/genbki.sh,v 1.8 1997/09/06 18:27:11 momjian Exp $
# $Header: /cvsroot/pgsql/src/backend/catalog/Attic/genbki.sh,v 1.9 1997/11/13 03:22:20 momjian Exp $
#
# NOTES
# non-essential whitespace is removed from the generated file.
@@ -18,6 +18,10 @@
# end can be changed into another awk script or something smarter..
#
#-------------------------------------------------------------------------
trap "rm -f /tmp/genbki.tmp" 0 1 2 3 15
# make sure it is empty
>/tmp/genbki.tmp
PATH=$PATH:/lib:/usr/ccs/lib # to find cpp
BKIOPTS=''
@@ -118,6 +122,27 @@ raw == 1 { print; next; }
/^DATA\(/ {
data = substr($0, 6, length($0) - 6);
print data;
nf = 1;
oid = 0;
while (nf <= NF-3)
{
if ($nf == "OID" && $(nf+1) == "=")
{
oid = $(nf+2);
break;
}
nf++;
}
next;
}
/^DESCR\(/ {
if (oid != 0)
{
data = substr($0, 8, length($0) - 9);
if (data != "")
printf "%d %s\n", oid, data >> "/tmp/genbki.tmp";
}
next;
}
@@ -235,6 +260,9 @@ cpp $BKIOPTS | \
sed -e '/^[ ]*$/d' \
-e 's/[ ][ ]*/ /g'
# send pg_description file contents to standard error
cat /tmp/genbki.tmp 1>&2
# ----------------
# all done
# ----------------