mirror of
https://github.com/postgres/postgres.git
synced 2025-07-31 22:04:40 +03:00
Make OIDs optional, per discussions in pghackers. WITH OIDS is still the
default, but OIDS are removed from many system catalogs that don't need them. Some interesting side effects: TOAST pointers are 20 bytes not 32 now; pg_description has a three-column key instead of one. Bugs fixed in passing: BINARY cursors work again; pg_class.relhaspkey has some usefulness; pg_dump dumps comments on indexes, rules, and triggers in a valid order. initdb forced.
This commit is contained in:
@ -4,7 +4,7 @@
|
||||
-- darcy@druid.net
|
||||
-- http://www.druid.net/darcy/
|
||||
--
|
||||
-- $Header: /cvsroot/pgsql/contrib/chkpass/Attic/chkpass.sql,v 1.1 2001/05/03 12:32:13 darcy Exp $
|
||||
-- $Header: /cvsroot/pgsql/contrib/chkpass/Attic/chkpass.sql,v 1.2 2001/08/10 18:57:32 tgl Exp $
|
||||
-- best viewed with tabs set to 4
|
||||
-- %%PGDIR%% changed to your local directory where modules is
|
||||
--
|
||||
@ -73,9 +73,7 @@ create operator <> (
|
||||
procedure = ne
|
||||
);
|
||||
|
||||
INSERT INTO pg_description (objoid, description)
|
||||
SELECT oid, 'password type with checks'
|
||||
FROM pg_type WHERE typname = 'chkpass';
|
||||
COMMENT ON TYPE chkpass IS 'password type with checks';
|
||||
|
||||
--
|
||||
-- eof
|
||||
|
@ -9,10 +9,10 @@ it on anything but an empty database, such as template1.
|
||||
Uses pgeasy library.
|
||||
|
||||
Run on an empty database, it returns the system join relationships (shown
|
||||
below for 7.1). Note that unexpected matches may indicate bogus entries
|
||||
below for 7.2). Note that unexpected matches may indicate bogus entries
|
||||
in system tables --- don't accept a peculiar match without question.
|
||||
In particular, a field shown as joining to more than one target table is
|
||||
probably messed up. In 7.1, the *only* field that should join to more
|
||||
probably messed up. In 7.2, the *only* field that should join to more
|
||||
than one target is pg_description.objoid. (Running make_oidjoins_check
|
||||
is an easy way to spot fields joining to more than one table, BTW.)
|
||||
|
||||
@ -27,9 +27,8 @@ revision in the patterns of cross-links between system tables.
|
||||
(Ideally we'd just regenerate the script as part of the regression
|
||||
tests themselves, but that seems too slow...)
|
||||
|
||||
NOTE: in 7.1, make_oidjoins_check produces two bogus join checks, one for
|
||||
pg_database.datlastsysoid => pg_description.oid and one for
|
||||
pg_class.relfilenode => pg_class.oid. These are artifacts and should not
|
||||
NOTE: in 7.2, make_oidjoins_check produces one bogus join check, for
|
||||
pg_class.relfilenode => pg_class.oid. This is an artifact and should not
|
||||
be added to the oidjoins regress test.
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
@ -41,13 +40,13 @@ Join pg_aggregate.aggtranstype => pg_type.oid
|
||||
Join pg_aggregate.aggfinaltype => pg_type.oid
|
||||
Join pg_am.amgettuple => pg_proc.oid
|
||||
Join pg_am.aminsert => pg_proc.oid
|
||||
Join pg_am.amdelete => pg_proc.oid
|
||||
Join pg_am.ambeginscan => pg_proc.oid
|
||||
Join pg_am.amrescan => pg_proc.oid
|
||||
Join pg_am.amendscan => pg_proc.oid
|
||||
Join pg_am.ammarkpos => pg_proc.oid
|
||||
Join pg_am.amrestrpos => pg_proc.oid
|
||||
Join pg_am.ambuild => pg_proc.oid
|
||||
Join pg_am.ambulkdelete => pg_proc.oid
|
||||
Join pg_am.amcostestimate => pg_proc.oid
|
||||
Join pg_amop.amopid => pg_am.oid
|
||||
Join pg_amop.amopclaid => pg_opclass.oid
|
||||
@ -61,6 +60,7 @@ Join pg_class.reltype => pg_type.oid
|
||||
Join pg_class.relam => pg_am.oid
|
||||
Join pg_class.reltoastrelid => pg_class.oid
|
||||
Join pg_class.reltoastidxid => pg_class.oid
|
||||
Join pg_description.classoid => pg_class.oid
|
||||
Join pg_index.indexrelid => pg_class.oid
|
||||
Join pg_index.indrelid => pg_class.oid
|
||||
Join pg_opclass.opcdeftype => pg_type.oid
|
||||
@ -78,7 +78,9 @@ Join pg_proc.prolang => pg_language.oid
|
||||
Join pg_proc.prorettype => pg_type.oid
|
||||
Join pg_rewrite.ev_class => pg_class.oid
|
||||
Join pg_statistic.starelid => pg_class.oid
|
||||
Join pg_statistic.staop => pg_operator.oid
|
||||
Join pg_statistic.staop1 => pg_operator.oid
|
||||
Join pg_statistic.staop2 => pg_operator.oid
|
||||
Join pg_statistic.staop3 => pg_operator.oid
|
||||
Join pg_trigger.tgrelid => pg_class.oid
|
||||
Join pg_trigger.tgfoid => pg_proc.oid
|
||||
Join pg_type.typrelid => pg_class.oid
|
||||
|
@ -38,7 +38,6 @@ main(int argc, char **argv)
|
||||
FROM pg_class c, pg_attribute a, pg_type t \
|
||||
WHERE a.attnum > 0 AND \
|
||||
relkind = 'r' AND \
|
||||
relhasrules = 'f' AND \
|
||||
(typname = 'oid' OR \
|
||||
typname = 'regproc') AND \
|
||||
a.attrelid = c.oid AND \
|
||||
@ -52,8 +51,7 @@ main(int argc, char **argv)
|
||||
DECLARE c_relations BINARY CURSOR FOR \
|
||||
SELECT relname \
|
||||
FROM pg_class c \
|
||||
WHERE relkind = 'r' AND \
|
||||
relhasrules = 'f' \
|
||||
WHERE relkind = 'r' AND relhasoids \
|
||||
ORDER BY 1; \
|
||||
");
|
||||
doquery("FETCH ALL IN c_relations");
|
||||
@ -71,14 +69,14 @@ main(int argc, char **argv)
|
||||
sprintf(query, "\
|
||||
DECLARE c_matches BINARY CURSOR FOR \
|
||||
SELECT count(*) \
|
||||
FROM %s t1, %s t2 \
|
||||
WHERE t1.%s = t2.oid ", relname, relname2, attname);
|
||||
FROM \"%s\" t1, \"%s\" t2 \
|
||||
WHERE t1.\"%s\" = t2.oid ", relname, relname2, attname);
|
||||
else
|
||||
sprintf(query, "\
|
||||
DECLARE c_matches BINARY CURSOR FOR \
|
||||
SELECT count(*) \
|
||||
FROM %s t1, %s t2 \
|
||||
WHERE RegprocToOid(t1.%s) = t2.oid ", relname, relname2, attname);
|
||||
FROM \"%s\" t1, \"%s\" t2 \
|
||||
WHERE RegprocToOid(t1.\"%s\") = t2.oid ", relname, relname2, attname);
|
||||
|
||||
doquery(query);
|
||||
doquery("FETCH ALL IN c_matches");
|
||||
|
@ -1,7 +1,7 @@
|
||||
#! /bin/sh
|
||||
|
||||
# You first run findoidjoins on the template1 database, and send that
|
||||
# output into this file to generate a list of SQL statements.
|
||||
# output into this script to generate a list of SQL statements.
|
||||
|
||||
# NOTE: any field that findoidjoins thinks joins to more than one table
|
||||
# will NOT be checked by the output of this script. You should be
|
||||
@ -41,7 +41,7 @@ $AWK -F'[ \.]' '\
|
||||
}
|
||||
{
|
||||
printf "\
|
||||
SELECT oid, %s.%s \n\
|
||||
SELECT ctid, %s.%s \n\
|
||||
FROM %s \n\
|
||||
WHERE %s.%s != 0 AND \n\
|
||||
NOT EXISTS(SELECT * FROM %s AS t1 WHERE t1.oid = %s.%s);\n",
|
||||
|
@ -11,42 +11,27 @@ BEGIN TRANSACTION;
|
||||
CREATE FUNCTION _int_contains(_int4, _int4) RETURNS bool
|
||||
AS 'MODULE_PATHNAME' LANGUAGE 'c' with (isstrict);
|
||||
|
||||
INSERT INTO pg_description (objoid, description)
|
||||
SELECT oid, 'contains'::text
|
||||
FROM pg_proc
|
||||
WHERE proname = '_int_contains'::name;
|
||||
COMMENT ON FUNCTION _int_contains(_int4, _int4) IS 'contains';
|
||||
|
||||
CREATE FUNCTION _int_contained(_int4, _int4) RETURNS bool
|
||||
AS 'MODULE_PATHNAME' LANGUAGE 'c' with (isstrict);
|
||||
|
||||
INSERT INTO pg_description (objoid, description)
|
||||
SELECT oid, 'contained in'::text
|
||||
FROM pg_proc
|
||||
WHERE proname = '_int_contained'::name;
|
||||
COMMENT ON FUNCTION _int_contained(_int4, _int4) IS 'contained in';
|
||||
|
||||
CREATE FUNCTION _int_overlap(_int4, _int4) RETURNS bool
|
||||
AS 'MODULE_PATHNAME' LANGUAGE 'c' with (isstrict);
|
||||
|
||||
INSERT INTO pg_description (objoid, description)
|
||||
SELECT oid, 'overlaps'::text
|
||||
FROM pg_proc
|
||||
WHERE proname = '_int_overlap'::name;
|
||||
COMMENT ON FUNCTION _int_overlap(_int4, _int4) IS 'overlaps';
|
||||
|
||||
CREATE FUNCTION _int_same(_int4, _int4) RETURNS bool
|
||||
AS 'MODULE_PATHNAME' LANGUAGE 'c' with (isstrict);
|
||||
|
||||
INSERT INTO pg_description (objoid, description)
|
||||
SELECT oid, 'same as'::text
|
||||
FROM pg_proc
|
||||
WHERE proname = '_int_same'::name;
|
||||
COMMENT ON FUNCTION _int_same(_int4, _int4) IS 'same as';
|
||||
|
||||
CREATE FUNCTION _int_different(_int4, _int4) RETURNS bool
|
||||
AS 'MODULE_PATHNAME' LANGUAGE 'c' with (isstrict);
|
||||
|
||||
INSERT INTO pg_description (objoid, description)
|
||||
SELECT oid, 'different'::text
|
||||
FROM pg_proc
|
||||
WHERE proname = '_int_different'::name;
|
||||
COMMENT ON FUNCTION _int_different(_int4, _int4) IS 'different';
|
||||
|
||||
-- support routines for indexing
|
||||
|
||||
|
Reference in New Issue
Block a user