CHANGES ------- initdb process has been changed in an attempt to automatically pin some basic types. pg_type and pg_proc currently. pg_relcheck replaced with more generic pg_constraint. Nearly all objects have an enforced RESTRICT / CASCADE except for in 'compiled' expressions. Ie. Views, function contents, default expressions, [-] completed [*] yet to do - Create Type - Create View * Create View (on precompile set deps in source) - Create Trigger - Create Table (Columns on Types) * Create Table / Column Defaults (on precompile set deps in source) - Create Sequence (currval, nextval, setval are PINNED) - Create Rule (always cascade) - Create Operator - Create Language - Create Index - Create Function * Create Function (on precompile set additional deps in source) - Create Aggregate - Drop Type (regress tested) - Drop View - Drop Trigger - Drop Table - Drop Sequence - Drop Rule - Drop Operator - Drop Language - Drop Index - Drop Function (regress tested) - Drop Aggregate - Alter Table / Primary Key - Alter Table / unique index * Alter Table / Default (Compiled default depends on functions / types within) - Alter Table / Add Column - Alter table / add column which creates toast table - Alter Table / Drop Constraint (Fixed to function as expected) - Drop pg_relcheck - Create pg_constraint - Insert check constraints into pg_constraint - Insert unique constraints into pg_constraint - Have unique key indicies depend on pg_constraint (implicit cascade) - Insert primary key constraints into pg_constraint - Have primary key indicies depend on pg_constraint (implicit cascade) - Insert foreign key constraints into pg_constraint - Have foreign key triggers depend on pg_constraint - Have pg_constraint depend on the table columns (not the table itself) - heap.c - Drop RemoveRelChecks() - pg_constraint - ConstraintCreate dependencies - Base type dependency on array type managed by pg_depend (always cascaded) - Table drop foreign key triggers as managed by pg_depend (always cascaded) - Toast tables depend on relation (always cascade) - Enable opt_behaviour for most items in gram.y - Disallow base functionality (types, procedures, and catalogs required for operation) to be dropped ever - Implicit drop of a SERIALs sequence (regress tested) - Alter Table / Drop Constraint (tablecmds->AlterTableDropConstraint) - Enable psql to view check and foreign key constraints (\d) on table definition - Have pg_dump use ALTER TABLE commands for Foreign Keys - Move Foreign Key constraint trigger creation to constraintCreate() from analyze.c. - Name triggers after the constraints -- but append a number and guarentee uniqueness OTHER NOTES ----------- CREATE TABLE tab (col1 int4 DEFAULT nextval('seq')); - DROP FUNCTION nextval(text) CASCADE; - Drop the column (col1) or set the default to NULL? Do objects depend on users (ownership)? ie. DROP USER CASCADE to dump everything they own when they're removed? Unique constraints for indicies have unique names across BOTH pg_constraint and pg_index. pg_constraint is unique to relid and index name so it's not that bad. One can drop a unique index without the constraint being dropped (DOH!). Attempts to fix cause circular dependency. ALTER TABLE DROP COLUMN should allow foreign key relations to only drop the foreign column, not the whole relation. CASCADEd drops should occur regardless of ownership of objects other than the one specifically specified (parent of cascade) Change foreign keys to work through a set of constraint functions using definitions from pg_constraint rather than doing work in the parser.