Commit 1b42ad7e authored by Peter Eisentraut's avatar Peter Eisentraut

Initial version of the SQL information schema

parent 2d8d6662
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/features.sgml,v 2.11 2002/12/06 05:07:12 momjian Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/features.sgml,v 2.12 2002/12/14 00:24:23 petere Exp $
--> -->
<appendix id="features"> <appendix id="features">
...@@ -655,6 +655,48 @@ $Header: /cvsroot/pgsql/doc/src/sgml/features.sgml,v 2.11 2002/12/06 05:07:12 mo ...@@ -655,6 +655,48 @@ $Header: /cvsroot/pgsql/doc/src/sgml/features.sgml,v 2.11 2002/12/06 05:07:12 mo
<entry>SQL comments using leading double minus</entry> <entry>SQL comments using leading double minus</entry>
<entry></entry> <entry></entry>
</row> </row>
<row>
<entry>F021</entry>
<entry>Core</entry>
<entry>Basic information schema</entry>
<entry></entry>
</row>
<row>
<entry>F021-01</entry>
<entry>Core</entry>
<entry>COLUMNS view</entry>
<entry></entry>
</row>
<row>
<entry>F021-02</entry>
<entry>Core</entry>
<entry>TABLES view</entry>
<entry></entry>
</row>
<row>
<entry>F021-03</entry>
<entry>Core</entry>
<entry>VIEWS view</entry>
<entry></entry>
</row>
<row>
<entry>F021-04</entry>
<entry>Core</entry>
<entry>TABLE_CONSTRAINTS view</entry>
<entry></entry>
</row>
<row>
<entry>F021-05</entry>
<entry>Core</entry>
<entry>REFERENTIAL_CONSTRAINTS view</entry>
<entry></entry>
</row>
<row>
<entry>F021-06</entry>
<entry>Core</entry>
<entry>CHECK_CONSTRAINTS view</entry>
<entry></entry>
</row>
<row> <row>
<entry>F031</entry> <entry>F031</entry>
<entry>Core</entry> <entry>Core</entry>
...@@ -905,6 +947,30 @@ $Header: /cvsroot/pgsql/doc/src/sgml/features.sgml,v 2.11 2002/12/06 05:07:12 mo ...@@ -905,6 +947,30 @@ $Header: /cvsroot/pgsql/doc/src/sgml/features.sgml,v 2.11 2002/12/06 05:07:12 mo
<entry>INSERT statement: DEFAULT VALUES clause</entry> <entry>INSERT statement: DEFAULT VALUES clause</entry>
<entry></entry> <entry></entry>
</row> </row>
<row>
<entry>F231</entry>
<entry></entry>
<entry>Privilege Tables</entry>
<entry></entry>
</row>
<row>
<entry>F231-01</entry>
<entry></entry>
<entry>TABLE_PRIVILEGES view</entry>
<entry></entry>
</row>
<row>
<entry>F231-02</entry>
<entry></entry>
<entry>COLUMN_PRIVILEGES view</entry>
<entry></entry>
</row>
<row>
<entry>F231-03</entry>
<entry></entry>
<entry>USAGE_PRIVILEGES view</entry>
<entry></entry>
</row>
<row> <row>
<entry>F251</entry> <entry>F251</entry>
<entry></entry> <entry></entry>
...@@ -1133,6 +1199,12 @@ $Header: /cvsroot/pgsql/doc/src/sgml/features.sgml,v 2.11 2002/12/06 05:07:12 mo ...@@ -1133,6 +1199,12 @@ $Header: /cvsroot/pgsql/doc/src/sgml/features.sgml,v 2.11 2002/12/06 05:07:12 mo
<entry>Constraint management</entry> <entry>Constraint management</entry>
<entry></entry> <entry></entry>
</row> </row>
<row>
<entry>F501-03</entry>
<entry>Core</entry>
<entry>SQL_LANGUAGES view</entry>
<entry></entry>
</row>
<row> <row>
<entry>F511</entry> <entry>F511</entry>
<entry></entry> <entry></entry>
...@@ -1557,48 +1629,6 @@ $Header: /cvsroot/pgsql/doc/src/sgml/features.sgml,v 2.11 2002/12/06 05:07:12 mo ...@@ -1557,48 +1629,6 @@ $Header: /cvsroot/pgsql/doc/src/sgml/features.sgml,v 2.11 2002/12/06 05:07:12 mo
<entry>Module language</entry> <entry>Module language</entry>
<entry></entry> <entry></entry>
</row> </row>
<row>
<entry>F021</entry>
<entry>Core</entry>
<entry>Basic information schema</entry>
<entry></entry>
</row>
<row>
<entry>F021-01</entry>
<entry>Core</entry>
<entry>COLUMNS view</entry>
<entry></entry>
</row>
<row>
<entry>F021-02</entry>
<entry>Core</entry>
<entry>TABLES view</entry>
<entry></entry>
</row>
<row>
<entry>F021-03</entry>
<entry>Core</entry>
<entry>VIEWS view</entry>
<entry></entry>
</row>
<row>
<entry>F021-04</entry>
<entry>Core</entry>
<entry>TABLE_CONSTRAINTS view</entry>
<entry></entry>
</row>
<row>
<entry>F021-05</entry>
<entry>Core</entry>
<entry>REFERENTIAL_CONSTRAINTS view</entry>
<entry></entry>
</row>
<row>
<entry>F021-06</entry>
<entry>Core</entry>
<entry>CHECK_CONSTRAINTS view</entry>
<entry></entry>
</row>
<row> <row>
<entry>F031-19</entry> <entry>F031-19</entry>
<entry>Core</entry> <entry>Core</entry>
...@@ -1667,30 +1697,6 @@ $Header: /cvsroot/pgsql/doc/src/sgml/features.sgml,v 2.11 2002/12/06 05:07:12 mo ...@@ -1667,30 +1697,6 @@ $Header: /cvsroot/pgsql/doc/src/sgml/features.sgml,v 2.11 2002/12/06 05:07:12 mo
<entry>SET TRANSACTION statement: DIAGNOSTICS SIZE clause</entry> <entry>SET TRANSACTION statement: DIAGNOSTICS SIZE clause</entry>
<entry></entry> <entry></entry>
</row> </row>
<row>
<entry>F231</entry>
<entry></entry>
<entry>Privilege Tables</entry>
<entry></entry>
</row>
<row>
<entry>F231-01</entry>
<entry></entry>
<entry>TABLE_PRIVILEGES view</entry>
<entry></entry>
</row>
<row>
<entry>F231-02</entry>
<entry></entry>
<entry>COLUMN_PRIVILEGES view</entry>
<entry></entry>
</row>
<row>
<entry>F231-03</entry>
<entry></entry>
<entry>USAGE_PRIVILEGES view</entry>
<entry></entry>
</row>
<row> <row>
<entry>F291</entry> <entry>F291</entry>
<entry></entry> <entry></entry>
...@@ -1769,12 +1775,6 @@ $Header: /cvsroot/pgsql/doc/src/sgml/features.sgml,v 2.11 2002/12/06 05:07:12 mo ...@@ -1769,12 +1775,6 @@ $Header: /cvsroot/pgsql/doc/src/sgml/features.sgml,v 2.11 2002/12/06 05:07:12 mo
<entry>SQL_SIZING view</entry> <entry>SQL_SIZING view</entry>
<entry></entry> <entry></entry>
</row> </row>
<row>
<entry>F501-03</entry>
<entry>Core</entry>
<entry>SQL_LANGUAGES view</entry>
<entry></entry>
</row>
<row> <row>
<entry>F502</entry> <entry>F502</entry>
<entry></entry> <entry></entry>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/release.sgml,v 1.169 2002/12/12 20:35:07 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/release.sgml,v 1.170 2002/12/14 00:24:23 petere Exp $
--> -->
<appendix id="release"> <appendix id="release">
...@@ -24,6 +24,7 @@ CDATA means the content is "SGML-free", so you can write without ...@@ -24,6 +24,7 @@ CDATA means the content is "SGML-free", so you can write without
worries about funny characters. worries about funny characters.
--> -->
<literallayout><![CDATA[ <literallayout><![CDATA[
Information schema
Domains now support CHECK constraints Domains now support CHECK constraints
]]></literallayout> ]]></literallayout>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# #
# Copyright (c) 1994, Regents of the University of California # Copyright (c) 1994, Regents of the University of California
# #
# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.88 2002/10/09 16:21:54 momjian Exp $ # $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.89 2002/12/14 00:24:23 petere Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
...@@ -131,7 +131,7 @@ ifeq ($(MAKE_DLL), true) ...@@ -131,7 +131,7 @@ ifeq ($(MAKE_DLL), true)
$(INSTALL_DATA) libpostgres.a $(DESTDIR)$(libdir)/libpostgres.a $(INSTALL_DATA) libpostgres.a $(DESTDIR)$(libdir)/libpostgres.a
endif endif
endif endif
$(MAKE) -C catalog install-bki $(MAKE) -C catalog install-data
$(INSTALL_DATA) $(srcdir)/libpq/pg_hba.conf.sample $(DESTDIR)$(datadir)/pg_hba.conf.sample $(INSTALL_DATA) $(srcdir)/libpq/pg_hba.conf.sample $(DESTDIR)$(datadir)/pg_hba.conf.sample
$(INSTALL_DATA) $(srcdir)/libpq/pg_ident.conf.sample $(DESTDIR)$(datadir)/pg_ident.conf.sample $(INSTALL_DATA) $(srcdir)/libpq/pg_ident.conf.sample $(DESTDIR)$(datadir)/pg_ident.conf.sample
$(INSTALL_DATA) $(srcdir)/utils/misc/postgresql.conf.sample $(DESTDIR)$(datadir)/postgresql.conf.sample $(INSTALL_DATA) $(srcdir)/utils/misc/postgresql.conf.sample $(DESTDIR)$(datadir)/postgresql.conf.sample
...@@ -170,7 +170,7 @@ ifeq ($(MAKE_DLL), true) ...@@ -170,7 +170,7 @@ ifeq ($(MAKE_DLL), true)
rm -f $(DESTDIR)$(libdir)/libpostgres.a rm -f $(DESTDIR)$(libdir)/libpostgres.a
endif endif
endif endif
$(MAKE) -C catalog uninstall-bki $(MAKE) -C catalog uninstall-data
rm -f $(DESTDIR)$(datadir)/pg_hba.conf.sample \ rm -f $(DESTDIR)$(datadir)/pg_hba.conf.sample \
$(DESTDIR)$(datadir)/pg_ident.conf.sample \ $(DESTDIR)$(datadir)/pg_ident.conf.sample \
$(DESTDIR)$(datadir)/postgresql.conf.sample $(DESTDIR)$(datadir)/postgresql.conf.sample
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# #
# Makefile for backend/catalog # Makefile for backend/catalog
# #
# $Header: /cvsroot/pgsql/src/backend/catalog/Makefile,v 1.42 2002/07/18 23:11:27 petere Exp $ # $Header: /cvsroot/pgsql/src/backend/catalog/Makefile,v 1.43 2002/12/14 00:24:24 petere Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
...@@ -41,17 +41,18 @@ postgres.bki postgres.description: genbki.sh $(POSTGRES_BKI_SRCS) \ ...@@ -41,17 +41,18 @@ postgres.bki postgres.description: genbki.sh $(POSTGRES_BKI_SRCS) \
$(top_srcdir)/src/include/postgres_ext.h $(top_builddir)/src/include/pg_config.h $(top_srcdir)/src/include/postgres_ext.h $(top_builddir)/src/include/pg_config.h
CPP='$(CPP)' AWK='$(AWK)' $(SHELL) $< $(BKIOPTS) -o postgres $(pg_includes) $(POSTGRES_BKI_SRCS) --set-version=$(VERSION) CPP='$(CPP)' AWK='$(AWK)' $(SHELL) $< $(BKIOPTS) -o postgres $(pg_includes) $(POSTGRES_BKI_SRCS) --set-version=$(VERSION)
.PHONY: install-bki .PHONY: install-data
install-bki: $(BKIFILES) installdirs install-data: $(BKIFILES) installdirs
$(INSTALL_DATA) postgres.bki $(DESTDIR)$(datadir)/postgres.bki $(INSTALL_DATA) postgres.bki $(DESTDIR)$(datadir)/postgres.bki
$(INSTALL_DATA) postgres.description $(DESTDIR)$(datadir)/postgres.description $(INSTALL_DATA) postgres.description $(DESTDIR)$(datadir)/postgres.description
$(INSTALL_DATA) information_schema.sql $(DESTDIR)$(datadir)/information_schema.sql
installdirs: installdirs:
$(mkinstalldirs) $(DESTDIR)$(datadir) $(mkinstalldirs) $(DESTDIR)$(datadir)
.PHONY: uninstall-bki .PHONY: uninstall-data
uninstall-bki: uninstall-data:
rm -f $(addprefix $(DESTDIR)$(datadir)/, $(BKIFILES)) rm -f $(addprefix $(DESTDIR)$(datadir)/, $(BKIFILES) information_schema.sql)
clean: clean:
......
This diff is collapsed.
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
# Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group # Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California # Portions Copyright (c) 1994, Regents of the University of California
# #
# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.177 2002/11/25 21:41:46 momjian Exp $ # $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.178 2002/12/14 00:24:24 petere Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
...@@ -1042,6 +1042,10 @@ EOF ...@@ -1042,6 +1042,10 @@ EOF
| "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
echo "ok" echo "ok"
$ECHO_N "creating information schema... "$ECHO_C
"$PGPATH"/postgres $PGSQL_OPT -N template1 > /dev/null < "$datadir"/information_schema.sql || exit_nicely
echo "ok"
$ECHO_N "vacuuming database template1... "$ECHO_C $ECHO_N "vacuuming database template1... "$ECHO_C
"$PGPATH"/postgres $PGSQL_OPT template1 >/dev/null <<EOF "$PGPATH"/postgres $PGSQL_OPT template1 >/dev/null <<EOF
......
...@@ -1266,7 +1266,7 @@ drop table cchild; ...@@ -1266,7 +1266,7 @@ drop table cchild;
-- --
-- Check that ruleutils are working -- Check that ruleutils are working
-- --
SELECT viewname, definition FROM pg_views ORDER BY viewname; SELECT viewname, definition FROM pg_views WHERE schemaname <> 'information_schema' ORDER BY viewname;
viewname | definition viewname | definition
--------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
iexit | SELECT ih.name, ih.thepath, interpt_pp(ih.thepath, r.thepath) AS exit FROM ihighway ih, ramp r WHERE (ih.thepath ## r.thepath); iexit | SELECT ih.name, ih.thepath, interpt_pp(ih.thepath, r.thepath) AS exit FROM ihighway ih, ramp r WHERE (ih.thepath ## r.thepath);
......
...@@ -59,7 +59,7 @@ WHERE (p1.typtype = 'c' AND p1.typrelid = 0) OR ...@@ -59,7 +59,7 @@ WHERE (p1.typtype = 'c' AND p1.typrelid = 0) OR
-- NOTE: as of 7.3, this check finds SET, smgr, and unknown. -- NOTE: as of 7.3, this check finds SET, smgr, and unknown.
SELECT p1.oid, p1.typname SELECT p1.oid, p1.typname
FROM pg_type as p1 FROM pg_type as p1
WHERE p1.typtype in ('b','d') AND p1.typname NOT LIKE '\\_%' AND NOT EXISTS WHERE p1.typtype in ('b') AND p1.typname NOT LIKE '\\_%' AND NOT EXISTS
(SELECT 1 FROM pg_type as p2 (SELECT 1 FROM pg_type as p2
WHERE p2.typname = ('_' || p1.typname)::name AND WHERE p2.typname = ('_' || p1.typname)::name AND
p2.typelem = p1.oid); p2.typelem = p1.oid);
......
...@@ -28,8 +28,9 @@ CREATE FUNCTION equipment(hobbies_r) ...@@ -28,8 +28,9 @@ CREATE FUNCTION equipment(hobbies_r)
CREATE FUNCTION user_relns() CREATE FUNCTION user_relns()
RETURNS setof name RETURNS setof name
AS 'select relname AS 'select relname
from pg_class from pg_class c, pg_namespace n
where relname !~ ''pg_.*'' and where relnamespace = n.oid and
(nspname !~ ''pg_.*'' and nspname <> ''information_schema'') and
relkind <> ''i'' ' relkind <> ''i'' '
LANGUAGE 'sql'; LANGUAGE 'sql';
......
...@@ -22,8 +22,9 @@ CREATE FUNCTION equipment(hobbies_r) ...@@ -22,8 +22,9 @@ CREATE FUNCTION equipment(hobbies_r)
CREATE FUNCTION user_relns() CREATE FUNCTION user_relns()
RETURNS setof name RETURNS setof name
AS 'select relname AS 'select relname
from pg_class from pg_class c, pg_namespace n
where relname !~ ''pg_.*'' and where relnamespace = n.oid and
(nspname !~ ''pg_.*'' and nspname <> ''information_schema'') and
relkind <> ''i'' ' relkind <> ''i'' '
LANGUAGE 'sql'; LANGUAGE 'sql';
CREATE FUNCTION pt_in_widget(point, widget) CREATE FUNCTION pt_in_widget(point, widget)
......
...@@ -763,7 +763,7 @@ drop table cchild; ...@@ -763,7 +763,7 @@ drop table cchild;
-- --
-- Check that ruleutils are working -- Check that ruleutils are working
-- --
SELECT viewname, definition FROM pg_views ORDER BY viewname; SELECT viewname, definition FROM pg_views WHERE schemaname <> 'information_schema' ORDER BY viewname;
SELECT tablename, rulename, definition FROM pg_rules SELECT tablename, rulename, definition FROM pg_rules
ORDER BY tablename, rulename; ORDER BY tablename, rulename;
......
...@@ -54,7 +54,7 @@ WHERE (p1.typtype = 'c' AND p1.typrelid = 0) OR ...@@ -54,7 +54,7 @@ WHERE (p1.typtype = 'c' AND p1.typrelid = 0) OR
SELECT p1.oid, p1.typname SELECT p1.oid, p1.typname
FROM pg_type as p1 FROM pg_type as p1
WHERE p1.typtype in ('b','d') AND p1.typname NOT LIKE '\\_%' AND NOT EXISTS WHERE p1.typtype in ('b') AND p1.typname NOT LIKE '\\_%' AND NOT EXISTS
(SELECT 1 FROM pg_type as p2 (SELECT 1 FROM pg_type as p2
WHERE p2.typname = ('_' || p1.typname)::name AND WHERE p2.typname = ('_' || p1.typname)::name AND
p2.typelem = p1.oid); p2.typelem = p1.oid);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment