Rewrite DROP's dependency traversal algorithm into an honest two-pass
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 8 Jun 2008 22:41:04 +0000 (22:41 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 8 Jun 2008 22:41:04 +0000 (22:41 +0000)
commit281a724d5cb8a5fea2f42e80575a768f5879b35c
treed1591cd101c1101eca0e7a4ecef572e05fae6810
parentcc87402d6e40994a53adeba0e11efb1bafcd6451
Rewrite DROP's dependency traversal algorithm into an honest two-pass
algorithm, replacing the original intention of a one-pass search, which
had been hacked up over time to be partially two-pass in hopes of handling
various corner cases better.  It still wasn't quite there, especially as
regards emitting unwanted NOTICE messages.  More importantly, this approach
lets us fix a number of open bugs concerning concurrent DROP scenarios,
because we can take locks during the first pass and avoid traversing to
dependent objects that were just deleted by someone else.

There is more that can be done here, but I'll go ahead and commit the
base patch before working on the options.
15 files changed:
src/backend/access/index/genam.c
src/backend/catalog/dependency.c
src/include/access/genam.h
src/include/catalog/dependency.h
src/test/regress/expected/alter_table.out
src/test/regress/expected/create_view.out
src/test/regress/expected/domain.out
src/test/regress/expected/foreign_key.out
src/test/regress/expected/inherit.out
src/test/regress/expected/namespace.out
src/test/regress/expected/plancache.out
src/test/regress/expected/privileges.out
src/test/regress/expected/subselect.out
src/test/regress/expected/truncate.out
src/test/regress/output/tablespace.source