Skip site navigation (1) Skip section navigation (2)

pg_depend patch

From: Rod Taylor <rbt(at)zort(dot)ca>
To: pgsql-patches(at)postgresql(dot)org
Subject: pg_depend patch
Date: 2002-05-09 02:07:13
Message-ID: 1020910034.475.20.camel@knight.zort.ca (view raw or flat)
Thread:
Lists: pgsql-patches
Creation of:
src/backend/catalog/pg_constraint.c
src/backend/catalog/pg_depend.c
src/include/catalog/pg_constraint.h
src/include/catalog/pg_depend.h
src/test/regress/expected/drop.out

Removed src/backend/catalog/pg_relcheck.h


TODO list attached which has a list of what I've done.  Additional notes
are below.


Postgresql TODOs completed with this patch:

- Add pg_depend table for dependency recording (slightly different
structure)
- Auto-destroy sequence on DROP of table with SERIAL
- Prevent column (relation) dropping if column is used by foreign key
- Make foreign keys easier to identify.

Worth mentioning:
- Prevent dropping system required functions and types.
- Move all constraints under a single namespace (unique to the relation)


pg_dump can be easily modified to pick up the new foreign key
structure.  There is NOT a mechanism to convert trigger style foreign
keys into constraint entries.

Renaming SERIAL sequences to include the OID would be useful and simple.

Function contents, view contents, and default values can depend on
objects.  Currently not tracked.  One needs to parse their node tree for
all types, functions, relations, columns, and other references recording
these in the pg_depend table.  Patch is still quite useful for other
reasons though :)


Regression tests will fail due to the OIDs used to name constraints
being different with each run.   Suggested solution is to disable NOTICE
during regression tests.  See 'Regression tests and NOTICE statements'
on hackers.

ALTER TABLE DROP CONSTRAINT is still not completely functional (same
state as before).

Documentation updates will follow.  They'll consist primarily of
describing RESTRICT and CASCADE keywords.


NOTE: REINDEX may do strange things.  It appears to be functional, but
has a special hook through dependencies so it won't complain too loudly.
Basically ignores restrictions and doesn't cascade beyond implicit
drops.


Enjoy!

--
Rod

Attachment: TODO.depend
Description: text/plain (3.3 KB)
Attachment: drop.out
Description: text/plain (5.0 KB)
Attachment: pg_depend.h
Description: text/x-c-header (2.8 KB)
Attachment: pg_constraint.h
Description: text/x-c-header (3.7 KB)
Attachment: pg_constraint.c
Description: text/x-c (8.8 KB)
Attachment: pg_depend.c
Description: text/x-c (19.0 KB)
Attachment: depend.patch
Description: text/plain (160.3 KB)

Responses

pgsql-patches by date

Next:From: sugitaDate: 2002-05-09 02:57:51
Subject: getopt_long patch for pg_dump and psql
Previous:From: Shaun ThomasDate: 2002-05-08 21:52:15
Subject: Contrib: Reindex script.

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group