Monday, June 9, 2008

[PATCHES] Tentative patch for making DROP put dependency info in DETAIL

There was some discussion a few days ago about making dependency.c emit
dependency reports in the same style that pg_shdepend.c does, viz
a lot of DETAIL lines on a single message instead of separate NOTICE
messages. Attached is a tentative patch that does that. See the
regression-test diffs for samples of what the output looks like.

I'm not entirely sure whether I like the results better than what
we have. Opinions anyone? There are some cases where it seems
clearly better, eg the sequence.out changes, but in a lot of others
it doesn't seem much better.

One particular case of interest is in truncate.out, where the
table-at-a-time implementation of DROP TABLE is clearly exposed
by the fact that you get multiple NOTICEs. I wonder if it would
be worth refactoring the code so that a multiple-object DROP is
implemented via performMultipleDeletions(). This would have more
than just cosmetic advantages: it would no longer matter what
order you listed the tables in. But the refactoring required looks
bigger and more tedious than I want to tackle right now.

I also want to note that we've historically had the code report
auto-cascade drops as DEBUG2 messages. I tried to merge those reports
into the main one but it was a complete mess :-( because the client and
server-log messages might have different numbers of entries depending on
their log-level settings. Almost the first case I tried favored me with
NOTICE: drop cascades to 0 other object(s)
DETAIL:
reported to the client (with the server log of course saying something
different). So I gave up and left that behavior separate.

Comments? Should we do this, or leave things alone?

regards, tom lane

No comments: