]> granicus.if.org Git - postgresql/commit
Limit overall indentation in rule/view dumps.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 30 Apr 2014 16:48:12 +0000 (12:48 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 30 Apr 2014 16:48:12 +0000 (12:48 -0400)
commit0601cb54dac14d979d726ab2ebeda251ae36e857
treed9cc59a25ea9bd53a98a2534d0a8312a9bd1f671
parentd166eed302400a71eed1aaa301d30be3af7b5715
Limit overall indentation in rule/view dumps.

Continuing to indent no matter how deeply nested we get doesn't really
do anything for readability; what's worse, it results in O(N^2) total
whitespace, which can become a performance and memory-consumption issue.

To address this, once we get past 40 characters of indentation, reduce
the indentation step distance 4x, and also limit the maximum indentation
by reducing it modulo 40.  This latter choice is a bit weird at first
glance, but it seems to preserve readability better than a simple cap
would do.

Back-patch to 9.3, because since commit 62e666400d the performance issue
is a hazard for pg_dump.

Greg Stark and Tom Lane
src/backend/utils/adt/ruleutils.c
src/test/regress/expected/rules.out