Limit overall indentation in rule/view dumps.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 30 Apr 2014 16:48:15 +0000 (12:48 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 30 Apr 2014 16:48:15 +0000 (12:48 -0400)
commitde6c439dc880ffa3536be7415a77ee65f56750e7
tree223cd7aea177d3ff799352254411a4e6f7897f1b
parent164acbe33c0951221b1ae2e5285c793f404a75a1
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