pgsql: Rework wrap-width calculation in psql's print_aligned_vertical()

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Rework wrap-width calculation in psql's print_aligned_vertical()
Дата
Msg-id E1a3XKG-0002FK-Pv@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Rework wrap-width calculation in psql's print_aligned_vertical() function.

This area was rather heavily whacked around in 6513633b9 and follow-on
commits, and it was showing it, because the logic to calculate the
allowable data width in wrapped expanded mode had only the vaguest
relationship to the logic that was actually printing the data.  It was
not very close to being right about the conditions requiring overhead
columns to be added.  Aside from being wrong, it was pretty unreadable
and under-commented.  Rewrite it so it corresponds to what the printing
code actually does.

In passing, remove a couple of dead tests in the printing logic, too.

Per a complaint from Jeff Janes, though this doesn't look much like his
patch because it fixes a number of other corner-case bogosities too.
One such fix that's visible in the regression test results is that
although the code was attempting to enforce a minimum data width of
3 columns, it sometimes left less space than that available.

Branch
------
REL9_5_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/4122ebcb1056655f23193e4632dccce68c524e43

Modified Files
--------------
src/bin/psql/print.c               |  127 +++++----
src/test/regress/expected/psql.out |  509 ++++++++++++++++++++++++++++--------
src/test/regress/sql/psql.sql      |   27 ++
3 files changed, 510 insertions(+), 153 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Rework wrap-width calculation in psql's print_aligned_vertical()
Следующее
От: Teodor Sigaev
Дата:
Сообщение: pgsql: Use pg_rewind when target timeline was switched