diff options
author | Andrew Dunstan <andrew@dunslane.net> | 2022-07-25 14:24:50 -0400 |
---|---|---|
committer | Andrew Dunstan <andrew@dunslane.net> | 2022-07-25 14:25:02 -0400 |
commit | a45388d6e0984abb02074f0300cd9c5cbda13848 (patch) | |
tree | 95689aab9fda59493f9f119f9e45b5f22f0d4fab /src/include | |
parent | b35617de37870756bdb0e00ffc0a42441e56eefa (diff) | |
download | postgresql-a45388d6e0984abb02074f0300cd9c5cbda13848.tar.gz postgresql-a45388d6e0984abb02074f0300cd9c5cbda13848.zip |
Add xheader_width pset option to psql
The setting controls tha maximum length of the header line in expanded
format output. Possible settings are full, column, page, or an integer.
the default is full, the current behaviour, and in this case the header
line is the length of the widest line of output. column causes the
header to be truncated to the width of the first column, page causes it
to be truncated to the width of the terminal page, and an integer causes
it to be truncated to that value. If the full value is less than the
page or integer value no truncation occurs. If given without an argument
this option prints its current setting.
Platon Pronko, somewhat modified by me.
Discussion: https://postgr.es/m/f03d38a3-db96-a56e-d1bc-dbbc80bbde4d@gmail.com
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/fe_utils/print.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/include/fe_utils/print.h b/src/include/fe_utils/print.h index bb2f1bf4e64..b8dbfa5f543 100644 --- a/src/include/fe_utils/print.h +++ b/src/include/fe_utils/print.h @@ -66,6 +66,15 @@ typedef enum printTextLineWrap PRINT_LINE_WRAP_NEWLINE /* Newline in data */ } printTextLineWrap; +typedef enum printXheaderWidthType +{ + /* Expanded header line width variants */ + PRINT_XHEADER_FULL, /* do not truncate header line (this is the default) */ + PRINT_XHEADER_COLUMN, /* only print header line above the first column */ + PRINT_XHEADER_PAGE, /* header line must not be longer than terminal width */ + PRINT_XHEADER_EXACT_WIDTH, /* explicitly specified width */ +} printXheaderWidthType; + typedef struct printTextFormat { /* A complete line style */ @@ -101,6 +110,8 @@ typedef struct printTableOpt enum printFormat format; /* see enum above */ unsigned short int expanded; /* expanded/vertical output (if supported * by output format); 0=no, 1=yes, 2=auto */ + printXheaderWidthType expanded_header_width_type; /* width type for header line in expanded mode */ + int expanded_header_exact_width; /* explicit width for header line in expanded mode */ unsigned short int border; /* Print a border around the table. 0=none, * 1=dividing lines, 2=full */ unsigned short int pager; /* use pager for output (if to stdout and |