Skip to content

Commit 14f1588

Browse files
committed
Add initdb code to set up initial contents of pg_depend, pinning all
objects created during initdb (except for the system views, which I think do not need to be pinned).
1 parent 93d6a8a commit 14f1588

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

src/bin/initdb/initdb.sh

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
# Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
2828
# Portions Copyright (c) 1994, Regents of the University of California
2929
#
30-
# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.157 2002/07/12 18:43:18 tgl Exp $
30+
# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.158 2002/07/16 17:48:46 tgl Exp $
3131
#
3232
#-------------------------------------------------------------------------
3333

@@ -697,6 +697,33 @@ fi
697697
echo "ok"
698698

699699

700+
$ECHO_N "initializing pg_depend... "$ECHO_C
701+
702+
"$PGPATH"/postgres $PGSQL_OPT template1 >/dev/null <<EOF
703+
-- Make PIN entries in pg_depend for all objects made so far in the tables
704+
-- that the dependency code handles. This is overkill (the system doesn't
705+
-- really depend on having every last weird datatype, for instance)
706+
-- but generating only the minimum required set of dependencies seems hard.
707+
-- Note that we deliberately do not pin the system views.
708+
-- First delete any already-made entries; PINs override all else, and must
709+
-- be the only entries for their objects.
710+
DELETE FROM pg_depend;
711+
INSERT INTO pg_depend SELECT 0,0,0, tableoid,oid,0, 'p' FROM pg_class;
712+
INSERT INTO pg_depend SELECT 0,0,0, tableoid,oid,0, 'p' FROM pg_proc;
713+
INSERT INTO pg_depend SELECT 0,0,0, tableoid,oid,0, 'p' FROM pg_type;
714+
INSERT INTO pg_depend SELECT 0,0,0, tableoid,oid,0, 'p' FROM pg_constraint;
715+
INSERT INTO pg_depend SELECT 0,0,0, tableoid,oid,0, 'p' FROM pg_attrdef;
716+
INSERT INTO pg_depend SELECT 0,0,0, tableoid,oid,0, 'p' FROM pg_language;
717+
INSERT INTO pg_depend SELECT 0,0,0, tableoid,oid,0, 'p' FROM pg_operator;
718+
INSERT INTO pg_depend SELECT 0,0,0, tableoid,oid,0, 'p' FROM pg_rewrite;
719+
INSERT INTO pg_depend SELECT 0,0,0, tableoid,oid,0, 'p' FROM pg_trigger;
720+
EOF
721+
if [ "$?" -ne 0 ]; then
722+
exit_nicely
723+
fi
724+
echo "ok"
725+
726+
700727
$ECHO_N "creating system views... "$ECHO_C
701728

702729
"$PGPATH"/postgres $PGSQL_OPT template1 >/dev/null <<EOF

0 commit comments

Comments
 (0)