Justin Clift wrote:
> Hi Neil,
>
> One of Nadia's points is:
>
> "In the release, Neil Conway comments that the new version contains a
> dependency tracking systems "that allows PostgreSQL to safely support
> many more subtle enhancements like the ability to drop columns". I'm
> unclear on the use of "safely" here - would you be able to elaborate on
> this comment further?"
Well since the comment was really mine (and I hid behind Neil), I'll tell you
what I was thinking and others can agree or shoot it down in flames ;-)
The point is that in the absence of dependency tracking, there is nothing to
prevent you from, for example, dropping a column that is used as a foreign key
reference, or is included in a view. With dependency tracking, DROP COLUMN is
a safer feature than it would have been, because you are prevented from
shooting yourself in the foot. E.g.:
test=# create table dep1(f1 int, f2 int);
CREATE TABLE
test=# create view vwdep as select f1,f2 from dep1 ;
CREATE VIEW
test=# alter table dep1 drop column f2;
NOTICE: rule _RETURN on view vwdep depends on table dep1 column f2
NOTICE: view vwdep depends on rule _RETURN on view vwdep
ERROR: Cannot drop table dep1 column f2 because other objects depend on it
Use DROP ... CASCADE to drop the dependent objects too
HTH,
Joe