]> granicus.if.org Git - postgresql/commitdiff
Add initdb code to set up initial contents of pg_depend, pinning all
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 16 Jul 2002 17:48:46 +0000 (17:48 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 16 Jul 2002 17:48:46 +0000 (17:48 +0000)
objects created during initdb (except for the system views, which I
think do not need to be pinned).

src/bin/initdb/initdb.sh

index 144dad4dbab9ac19a129ee999d904886263f144c..9948bcd7fe43e1e95e478c0acb7aa467a17015df 100644 (file)
@@ -27,7 +27,7 @@
 # Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
 # Portions Copyright (c) 1994, Regents of the University of California
 #
-# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.157 2002/07/12 18:43:18 tgl Exp $
+# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.158 2002/07/16 17:48:46 tgl Exp $
 #
 #-------------------------------------------------------------------------
 
@@ -697,6 +697,33 @@ fi
 echo "ok"
 
 
+$ECHO_N "initializing pg_depend... "$ECHO_C
+
+"$PGPATH"/postgres $PGSQL_OPT template1 >/dev/null <<EOF
+-- Make PIN entries in pg_depend for all objects made so far in the tables
+-- that the dependency code handles.  This is overkill (the system doesn't
+-- really depend on having every last weird datatype, for instance)
+-- but generating only the minimum required set of dependencies seems hard.
+-- Note that we deliberately do not pin the system views.
+-- First delete any already-made entries; PINs override all else, and must
+-- be the only entries for their objects.
+DELETE FROM pg_depend;
+INSERT INTO pg_depend SELECT 0,0,0, tableoid,oid,0, 'p' FROM pg_class;
+INSERT INTO pg_depend SELECT 0,0,0, tableoid,oid,0, 'p' FROM pg_proc;
+INSERT INTO pg_depend SELECT 0,0,0, tableoid,oid,0, 'p' FROM pg_type;
+INSERT INTO pg_depend SELECT 0,0,0, tableoid,oid,0, 'p' FROM pg_constraint;
+INSERT INTO pg_depend SELECT 0,0,0, tableoid,oid,0, 'p' FROM pg_attrdef;
+INSERT INTO pg_depend SELECT 0,0,0, tableoid,oid,0, 'p' FROM pg_language;
+INSERT INTO pg_depend SELECT 0,0,0, tableoid,oid,0, 'p' FROM pg_operator;
+INSERT INTO pg_depend SELECT 0,0,0, tableoid,oid,0, 'p' FROM pg_rewrite;
+INSERT INTO pg_depend SELECT 0,0,0, tableoid,oid,0, 'p' FROM pg_trigger;
+EOF
+if [ "$?" -ne 0 ]; then
+    exit_nicely
+fi
+echo "ok"
+
+
 $ECHO_N "creating system views... "$ECHO_C
 
 "$PGPATH"/postgres $PGSQL_OPT template1 >/dev/null <<EOF