psql: Count all table footer lines in pager setup - Mailing list pgsql-hackers

From Erik Wienhold
Subject psql: Count all table footer lines in pager setup
Date
Msg-id 2dd2430f-dd20-4c89-97fd-242616a3d768@ewie.name
Whole thread Raw
List pgsql-hackers
Here's a patch to fix the pager setup when printing tables with large
footers, e.g., long view definitions.

For testing create a view with many columns (50 in this example):

    select 'create view longview as select ' || string_agg('1 f' || s, ', ')
    from generate_series(1, 50) s
    \gexec

Then describe the view with verbose output to also print its definition
in the table footer:

    \d+ longview

Without the patch, no pager is used when the terminal can display 55 or
more lines (check with `stty size`).  Below 55 available lines the pager
is always used because the table itself requires 54 lines (50 view
columns + 3 header lines + 1 "View definition" footer line).

With the patch applied, the lines of the view definition also count
towards the line total and the pager is used when more than 54 lines are
available.

-- 
Erik Wienhold

Attachment

pgsql-hackers by date:

Previous
From: Erik Wienhold
Date:
Subject: Re: CREATE OR REPLACE MATERIALIZED VIEW
Next
From: "Zhijie Hou (Fujitsu)"
Date:
Subject: RE: Conflict detection for update_deleted in logical replication