pgsql: Fix ruleutils pretty-printing to not generate trailing whitespac - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Fix ruleutils pretty-printing to not generate trailing whitespac
Date
Msg-id E1VfwM2-0005ZF-96@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Fix ruleutils pretty-printing to not generate trailing whitespace.

The pretty-printing logic in ruleutils.c operates by inserting a newline
and some indentation whitespace into strings that are already valid SQL.
This naturally results in leaving some trailing whitespace before the
newline in many cases; which can be annoying when processing the output
with other tools, as complained of by Joe Abbate.  We can fix that in
a pretty localized fashion by deleting any trailing whitespace before
we append a pretty-printing newline.  In addition, we have to modify the
code inserted by commit 2f582f76b1945929ff07116cd4639747ce9bb8a1 so that
we also delete trailing whitespace when transposing items from temporary
buffers into the main result string, when a temporary item starts with a
newline.

This results in rather voluminous changes to the regression test results,
but it's easily verified that they are only removal of trailing whitespace.

Back-patch to 9.3, because the aforementioned commit resulted in many
more cases of trailing whitespace than had occurred in earlier branches.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/0b7e660d6c70f45e06f1b52f255116bcb44624eb

Modified Files
--------------
src/backend/utils/adt/ruleutils.c             |  129 +--
src/test/regress/expected/aggregates.out      |   24 +-
src/test/regress/expected/create_view.out     |   96 +--
src/test/regress/expected/matview.out         |   18 +-
src/test/regress/expected/polymorphism.out    |    6 +-
src/test/regress/expected/rules.out           | 1136 ++++++++++++-------------
src/test/regress/expected/triggers.out        |    2 +-
src/test/regress/expected/updatable_views.out |    2 +-
src/test/regress/expected/with.out            |    2 +-
9 files changed, 723 insertions(+), 692 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Fix ruleutils pretty-printing to not generate trailing whitespac
Next
From: Tom Lane
Date:
Subject: pgsql: Fix failure with whole-row reference to a subquery.