summaryrefslogtreecommitdiff
path: root/src/test/regress
diff options
context:
space:
mode:
authorGreg Stark2014-04-28 17:41:36 +0000
committerGreg Stark2014-04-28 17:41:36 +0000
commit6513633b94173fc1d9e2b213c43f9422ddbf5faa (patch)
treea529e6587c31238582da66cab7aa6069306beb2c /src/test/regress
parentd2722443d993988ff2e529b652c61fec1ca527f7 (diff)
Add support for wrapping to psql's "extended" mode. This makes it very
feasible to display tables that have both many columns and some large data in some columns (such as pg_stats). Emre Hasegeli with review and rewriting from Sergey Muraviov and reviewed by Greg Stark
Diffstat (limited to 'src/test/regress')
-rw-r--r--src/test/regress/expected/psql.out944
-rw-r--r--src/test/regress/sql/psql.sql120
2 files changed, 1064 insertions, 0 deletions
diff --git a/src/test/regress/expected/psql.out b/src/test/regress/expected/psql.out
index 2bbee7df004..c7dbd543071 100644
--- a/src/test/regress/expected/psql.out
+++ b/src/test/regress/expected/psql.out
@@ -68,3 +68,947 @@ Record separator (recordsep) is <newline>.
Table attributes (tableattr) unset.
Title (title) unset.
Tuples only (tuples_only) is off.
+-- test multi-line headers, wrapping, and newline indicators
+prepare q as select array_to_string(array_agg(repeat('x',2*n)),E'\n') as "a
+
+b", array_to_string(array_agg(repeat('y',20-2*n)),E'\n') as "a
+b" from generate_series(1,10) as n(n) group by n>1 ;
+\pset linestyle ascii
+\pset expanded off
+\pset columns 40
+\pset border 0
+\pset format unaligned
+execute q;
+a
+
+b|a
+b
+xx|yyyyyyyyyyyyyyyyyy
+xxxx
+xxxxxx
+xxxxxxxx
+xxxxxxxxxx
+xxxxxxxxxxxx
+xxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxx|yyyyyyyyyyyyyyyy
+yyyyyyyyyyyyyy
+yyyyyyyyyyyy
+yyyyyyyyyy
+yyyyyyyy
+yyyyyy
+yyyy
+yy
+
+(2 rows)
+\pset format aligned
+execute q;
+ a + a +
+ + b
+ b
+-------------------- ------------------
+xx yyyyyyyyyyyyyyyyyy
+xxxx +yyyyyyyyyyyyyyyy +
+xxxxxx +yyyyyyyyyyyyyy +
+xxxxxxxx +yyyyyyyyyyyy +
+xxxxxxxxxx +yyyyyyyyyy +
+xxxxxxxxxxxx +yyyyyyyy +
+xxxxxxxxxxxxxx +yyyyyy +
+xxxxxxxxxxxxxxxx +yyyy +
+xxxxxxxxxxxxxxxxxx +yy +
+xxxxxxxxxxxxxxxxxxxx
+(2 rows)
+
+\pset format wrapped
+execute q;
+ a + a +
+ + b
+ b
+-------------------- ------------------
+xx yyyyyyyyyyyyyyyyyy
+xxxx +yyyyyyyyyyyyyyyy +
+xxxxxx +yyyyyyyyyyyyyy +
+xxxxxxxx +yyyyyyyyyyyy +
+xxxxxxxxxx +yyyyyyyyyy +
+xxxxxxxxxxxx +yyyyyyyy +
+xxxxxxxxxxxxxx +yyyyyy +
+xxxxxxxxxxxxxxxx +yyyy +
+xxxxxxxxxxxxxxxxxx +yy +
+xxxxxxxxxxxxxxxxxxxx
+(2 rows)
+
+\pset border 1
+\pset format unaligned
+execute q;
+a
+
+b|a
+b
+xx|yyyyyyyyyyyyyyyyyy
+xxxx
+xxxxxx
+xxxxxxxx
+xxxxxxxxxx
+xxxxxxxxxxxx
+xxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxx|yyyyyyyyyyyyyyyy
+yyyyyyyyyyyyyy
+yyyyyyyyyyyy
+yyyyyyyyyy
+yyyyyyyy
+yyyyyy
+yyyy
+yy
+
+(2 rows)
+\pset format aligned
+execute q;
+ a +| a +
+ +| b
+ b |
+----------------------+--------------------
+ xx | yyyyyyyyyyyyyyyyyy
+ xxxx +| yyyyyyyyyyyyyyyy +
+ xxxxxx +| yyyyyyyyyyyyyy +
+ xxxxxxxx +| yyyyyyyyyyyy +
+ xxxxxxxxxx +| yyyyyyyyyy +
+ xxxxxxxxxxxx +| yyyyyyyy +
+ xxxxxxxxxxxxxx +| yyyyyy +
+ xxxxxxxxxxxxxxxx +| yyyy +
+ xxxxxxxxxxxxxxxxxx +| yy +
+ xxxxxxxxxxxxxxxxxxxx |
+(2 rows)
+
+\pset format wrapped
+execute q;
+ a +| a +
+ +| b
+ b |
+-------------------+--------------------
+ xx | yyyyyyyyyyyyyyyyyy
+ xxxx +| yyyyyyyyyyyyyyyy +
+ xxxxxx +| yyyyyyyyyyyyyy +
+ xxxxxxxx +| yyyyyyyyyyyy +
+ xxxxxxxxxx +| yyyyyyyyyy +
+ xxxxxxxxxxxx +| yyyyyyyy +
+ xxxxxxxxxxxxxx +| yyyyyy +
+ xxxxxxxxxxxxxxxx +| yyyy +
+ xxxxxxxxxxxxxxxxx.| yy +
+.x +|
+ xxxxxxxxxxxxxxxxx.|
+.xxx |
+(2 rows)
+
+\pset border 2
+\pset format unaligned
+execute q;
+a
+
+b|a
+b
+xx|yyyyyyyyyyyyyyyyyy
+xxxx
+xxxxxx
+xxxxxxxx
+xxxxxxxxxx
+xxxxxxxxxxxx
+xxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxx|yyyyyyyyyyyyyyyy
+yyyyyyyyyyyyyy
+yyyyyyyyyyyy
+yyyyyyyyyy
+yyyyyyyy
+yyyyyy
+yyyy
+yy
+
+(2 rows)
+\pset format aligned
+execute q;
++----------------------+--------------------+
+| a +| a +|
+| +| b |
+| b | |
++----------------------+--------------------+
+| xx | yyyyyyyyyyyyyyyyyy |
+| xxxx +| yyyyyyyyyyyyyyyy +|
+| xxxxxx +| yyyyyyyyyyyyyy +|
+| xxxxxxxx +| yyyyyyyyyyyy +|
+| xxxxxxxxxx +| yyyyyyyyyy +|
+| xxxxxxxxxxxx +| yyyyyyyy +|
+| xxxxxxxxxxxxxx +| yyyyyy +|
+| xxxxxxxxxxxxxxxx +| yyyy +|
+| xxxxxxxxxxxxxxxxxx +| yy +|
+| xxxxxxxxxxxxxxxxxxxx | |
++----------------------+--------------------+
+(2 rows)
+
+\pset format wrapped
+execute q;
++-----------------+--------------------+
+| a +| a +|
+| +| b |
+| b | |
++-----------------+--------------------+
+| xx | yyyyyyyyyyyyyyyyyy |
+| xxxx +| yyyyyyyyyyyyyyyy +|
+| xxxxxx +| yyyyyyyyyyyyyy +|
+| xxxxxxxx +| yyyyyyyyyyyy +|
+| xxxxxxxxxx +| yyyyyyyyyy +|
+| xxxxxxxxxxxx +| yyyyyyyy +|
+| xxxxxxxxxxxxxx +| yyyyyy +|
+| xxxxxxxxxxxxxxx.| yyyy +|
+|.x +| yy +|
+| xxxxxxxxxxxxxxx.| |
+|.xxx +| |
+| xxxxxxxxxxxxxxx.| |
+|.xxxxx | |
++-----------------+--------------------+
+(2 rows)
+
+\pset expanded on
+\pset columns 20
+\pset border 0
+\pset format unaligned
+execute q;
+a
+
+b|xx
+a
+b|yyyyyyyyyyyyyyyyyy
+
+a
+
+b|xxxx
+xxxxxx
+xxxxxxxx
+xxxxxxxxxx
+xxxxxxxxxxxx
+xxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxx
+a
+b|yyyyyyyyyyyyyyyy
+yyyyyyyyyyyyyy
+yyyyyyyyyyyy
+yyyyyyyyyy
+yyyyyyyy
+yyyyyy
+yyyy
+yy
+
+\pset format aligned
+execute q;
+* Record 1
+ a+ xx
+ +
+ b
+ a+ yyyyyyyyyyyyyyyyyy
+ b
+* Record 2
+ a+ xxxx +
+ + xxxxxx +
+ b xxxxxxxx +
+ xxxxxxxxxx +
+ xxxxxxxxxxxx +
+ xxxxxxxxxxxxxx +
+ xxxxxxxxxxxxxxxx +
+ xxxxxxxxxxxxxxxxxx +
+ xxxxxxxxxxxxxxxxxxxx
+ a+ yyyyyyyyyyyyyyyy +
+ b yyyyyyyyyyyyyy +
+ yyyyyyyyyyyy +
+ yyyyyyyyyy +
+ yyyyyyyy +
+ yyyyyy +
+ yyyy +
+ yy +
+
+
+\pset format wrapped
+execute q;
+* Record 1
+ a+ xx
+ +
+ b
+ a+ yyyyyyyyyyyyyyyyyy
+ b
+* Record 2
+ a+ xxxx +
+ + xxxxxx +
+ b xxxxxxxx +
+ xxxxxxxxxx +
+ xxxxxxxxxxxx +
+ xxxxxxxxxxxxxx +
+ xxxxxxxxxxxxxxxx +
+ xxxxxxxxxxxxxxxxxx+
+ xxxxxxxxxxxxxxxxxx.
+ .xx
+ a+ yyyyyyyyyyyyyyyy +
+ b yyyyyyyyyyyyyy +
+ yyyyyyyyyyyy +
+ yyyyyyyyyy +
+ yyyyyyyy +
+ yyyyyy +
+ yyyy +
+ yy +
+
+
+\pset border 1
+\pset format unaligned
+execute q;
+a
+
+b|xx
+a
+b|yyyyyyyyyyyyyyyyyy
+
+a
+
+b|xxxx
+xxxxxx
+xxxxxxxx
+xxxxxxxxxx
+xxxxxxxxxxxx
+xxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxx
+a
+b|yyyyyyyyyyyyyyyy
+yyyyyyyyyyyyyy
+yyyyyyyyyyyy
+yyyyyyyyyy
+yyyyyyyy
+yyyyyy
+yyyy
+yy
+
+\pset format aligned
+execute q;
+-[ RECORD 1 ]-----------
+ a+| xx
+ +|
+ b |
+ a+| yyyyyyyyyyyyyyyyyy
+ b |
+-[ RECORD 2 ]-----------
+ a+| xxxx +
+ +| xxxxxx +
+ b | xxxxxxxx +
+ | xxxxxxxxxx +
+ | xxxxxxxxxxxx +
+ | xxxxxxxxxxxxxx +
+ | xxxxxxxxxxxxxxxx +
+ | xxxxxxxxxxxxxxxxxx +
+ | xxxxxxxxxxxxxxxxxxxx
+ a+| yyyyyyyyyyyyyyyy +
+ b | yyyyyyyyyyyyyy +
+ | yyyyyyyyyyyy +
+ | yyyyyyyyyy +
+ | yyyyyyyy +
+ | yyyyyy +
+ | yyyy +
+ | yy +
+ |
+
+\pset format wrapped
+execute q;
+-[ RECORD 1 ]-------
+ a+| xx
+ +|
+ b |
+ a+| yyyyyyyyyyyyyyyy.
+ b |.yy
+-[ RECORD 2 ]-------
+ a+| xxxx +
+ +| xxxxxx +
+ b | xxxxxxxx +
+ | xxxxxxxxxx +
+ | xxxxxxxxxxxx +
+ | xxxxxxxxxxxxxx +
+ | xxxxxxxxxxxxxxxx+
+ | xxxxxxxxxxxxxxxx.
+ |.xx +
+ | xxxxxxxxxxxxxxxx.
+ |.xxxx
+ a+| yyyyyyyyyyyyyyyy+
+ b | yyyyyyyyyyyyyy +
+ | yyyyyyyyyyyy +
+ | yyyyyyyyyy +
+ | yyyyyyyy +
+ | yyyyyy +
+ | yyyy +
+ | yy +
+ |
+
+\pset border 2
+\pset format unaligned
+execute q;
+a
+
+b|xx
+a
+b|yyyyyyyyyyyyyyyyyy
+
+a
+
+b|xxxx
+xxxxxx
+xxxxxxxx
+xxxxxxxxxx
+xxxxxxxxxxxx
+xxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxx
+a
+b|yyyyyyyyyyyyyyyy
+yyyyyyyyyyyyyy
+yyyyyyyyyyyy
+yyyyyyyyyy
+yyyyyyyy
+yyyyyy
+yyyy
+yy
+
+\pset format aligned
+execute q;
++-[ RECORD 1 ]-------------+
+| a+| xx |
+| +| |
+| b | |
+| a+| yyyyyyyyyyyyyyyyyy |
+| b | |
++-[ RECORD 2 ]-------------+
+| a+| xxxx +|
+| +| xxxxxx +|
+| b | xxxxxxxx +|
+| | xxxxxxxxxx +|
+| | xxxxxxxxxxxx +|
+| | xxxxxxxxxxxxxx +|
+| | xxxxxxxxxxxxxxxx +|
+| | xxxxxxxxxxxxxxxxxx +|
+| | xxxxxxxxxxxxxxxxxxxx |
+| a+| yyyyyyyyyyyyyyyy +|
+| b | yyyyyyyyyyyyyy +|
+| | yyyyyyyyyyyy +|
+| | yyyyyyyyyy +|
+| | yyyyyyyy +|
+| | yyyyyy +|
+| | yyyy +|
+| | yy +|
+| | |
++---+----------------------+
+
+\pset format wrapped
+execute q;
++-[ RECORD 1 ]-----+
+| a+| xx |
+| +| |
+| b | |
+| a+| yyyyyyyyyyyy.|
+| b |.yyyyyy |
++-[ RECORD 2 ]-----+
+| a+| xxxx +|
+| +| xxxxxx +|
+| b | xxxxxxxx +|
+| | xxxxxxxxxx +|
+| | xxxxxxxxxxxx+|
+| | xxxxxxxxxxxx.|
+| |.xx +|
+| | xxxxxxxxxxxx.|
+| |.xxxx +|
+| | xxxxxxxxxxxx.|
+| |.xxxxxx +|
+| | xxxxxxxxxxxx.|
+| |.xxxxxxxx |
+| a+| yyyyyyyyyyyy.|
+| b |.yyyy +|
+| | yyyyyyyyyyyy.|
+| |.yy +|
+| | yyyyyyyyyyyy+|
+| | yyyyyyyyyy +|
+| | yyyyyyyy +|
+| | yyyyyy +|
+| | yyyy +|
+| | yy +|
+| | |
++---+--------------+
+
+\pset linestyle old-ascii
+\pset expanded off
+\pset columns 40
+\pset border 0
+\pset format unaligned
+execute q;
+a
+
+b|a
+b
+xx|yyyyyyyyyyyyyyyyyy
+xxxx
+xxxxxx
+xxxxxxxx
+xxxxxxxxxx
+xxxxxxxxxxxx
+xxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxx|yyyyyyyyyyyyyyyy
+yyyyyyyyyyyyyy
+yyyyyyyyyyyy
+yyyyyyyyyy
+yyyyyyyy
+yyyyyy
+yyyy
+yy
+
+(2 rows)
+\pset format aligned
+execute q;
+ a a
+ + b
+ b +
+-------------------- ------------------
+xx yyyyyyyyyyyyyyyyyy
+xxxx yyyyyyyyyyyyyyyy
+xxxxxx yyyyyyyyyyyyyy
+xxxxxxxx yyyyyyyyyyyy
+xxxxxxxxxx yyyyyyyyyy
+xxxxxxxxxxxx yyyyyyyy
+xxxxxxxxxxxxxx yyyyyy
+xxxxxxxxxxxxxxxx yyyy
+xxxxxxxxxxxxxxxxxx yy
+xxxxxxxxxxxxxxxxxxxx
+(2 rows)
+
+\pset format wrapped
+execute q;
+ a a
+ + b
+ b +
+-------------------- ------------------
+xx yyyyyyyyyyyyyyyyyy
+xxxx yyyyyyyyyyyyyyyy
+xxxxxx yyyyyyyyyyyyyy
+xxxxxxxx yyyyyyyyyyyy
+xxxxxxxxxx yyyyyyyyyy
+xxxxxxxxxxxx yyyyyyyy
+xxxxxxxxxxxxxx yyyyyy
+xxxxxxxxxxxxxxxx yyyy
+xxxxxxxxxxxxxxxxxx yy
+xxxxxxxxxxxxxxxxxxxx
+(2 rows)
+
+\pset border 1
+\pset format unaligned
+execute q;
+a
+
+b|a
+b
+xx|yyyyyyyyyyyyyyyyyy
+xxxx
+xxxxxx
+xxxxxxxx
+xxxxxxxxxx
+xxxxxxxxxxxx
+xxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxx|yyyyyyyyyyyyyyyy
+yyyyyyyyyyyyyy
+yyyyyyyyyyyy
+yyyyyyyyyy
+yyyyyyyy
+yyyyyy
+yyyy
+yy
+
+(2 rows)
+\pset format aligned
+execute q;
+ a | a
++ |+ b
++ b |+
+----------------------+--------------------
+ xx | yyyyyyyyyyyyyyyyyy
+ xxxx | yyyyyyyyyyyyyyyy
+ xxxxxx : yyyyyyyyyyyyyy
+ xxxxxxxx : yyyyyyyyyyyy
+ xxxxxxxxxx : yyyyyyyyyy
+ xxxxxxxxxxxx : yyyyyyyy
+ xxxxxxxxxxxxxx : yyyyyy
+ xxxxxxxxxxxxxxxx : yyyy
+ xxxxxxxxxxxxxxxxxx : yy
+ xxxxxxxxxxxxxxxxxxxx :
+(2 rows)
+
+\pset format wrapped
+execute q;
+ a | a
++ |+ b
++ b |+
+-------------------+--------------------
+ xx | yyyyyyyyyyyyyyyyyy
+ xxxx | yyyyyyyyyyyyyyyy
+ xxxxxx : yyyyyyyyyyyyyy
+ xxxxxxxx : yyyyyyyyyyyy
+ xxxxxxxxxx : yyyyyyyyyy
+ xxxxxxxxxxxx : yyyyyyyy
+ xxxxxxxxxxxxxx : yyyyyy
+ xxxxxxxxxxxxxxxx : yyyy
+ xxxxxxxxxxxxxxxxx : yy
+ x :
+ xxxxxxxxxxxxxxxxx
+ xxx
+(2 rows)
+
+\pset border 2
+\pset format unaligned
+execute q;
+a
+
+b|a
+b
+xx|yyyyyyyyyyyyyyyyyy
+xxxx
+xxxxxx
+xxxxxxxx
+xxxxxxxxxx
+xxxxxxxxxxxx
+xxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxx|yyyyyyyyyyyyyyyy
+yyyyyyyyyyyyyy
+yyyyyyyyyyyy
+yyyyyyyyyy
+yyyyyyyy
+yyyyyy
+yyyy
+yy
+
+(2 rows)
+\pset format aligned
+execute q;
++----------------------+--------------------+
+| a | a |
+|+ |+ b |
+|+ b |+ |
++----------------------+--------------------+
+| xx | yyyyyyyyyyyyyyyyyy |
+| xxxx | yyyyyyyyyyyyyyyy |
+| xxxxxx : yyyyyyyyyyyyyy |
+| xxxxxxxx : yyyyyyyyyyyy |
+| xxxxxxxxxx : yyyyyyyyyy |
+| xxxxxxxxxxxx : yyyyyyyy |
+| xxxxxxxxxxxxxx : yyyyyy |
+| xxxxxxxxxxxxxxxx : yyyy |
+| xxxxxxxxxxxxxxxxxx : yy |
+| xxxxxxxxxxxxxxxxxxxx : |
++----------------------+--------------------+
+(2 rows)
+
+\pset format wrapped
+execute q;
++-----------------+--------------------+
+| a | a |
+|+ |+ b |
+|+ b |+ |
++-----------------+--------------------+
+| xx | yyyyyyyyyyyyyyyyyy |
+| xxxx | yyyyyyyyyyyyyyyy |
+| xxxxxx : yyyyyyyyyyyyyy |
+| xxxxxxxx : yyyyyyyyyyyy |
+| xxxxxxxxxx : yyyyyyyyyy |
+| xxxxxxxxxxxx : yyyyyyyy |
+| xxxxxxxxxxxxxx : yyyyyy |
+| xxxxxxxxxxxxxxx : yyyy |
+| x : yy |
+| xxxxxxxxxxxxxxx : |
+| xxx |
+| xxxxxxxxxxxxxxx |
+| xxxxx |
++-----------------+--------------------+
+(2 rows)
+
+\pset expanded on
+\pset columns 20
+\pset border 0
+\pset format unaligned
+execute q;
+a
+
+b|xx
+a
+b|yyyyyyyyyyyyyyyyyy
+
+a
+
+b|xxxx
+xxxxxx
+xxxxxxxx
+xxxxxxxxxx
+xxxxxxxxxxxx
+xxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxx
+a
+b|yyyyyyyyyyyyyyyy
+yyyyyyyyyyyyyy
+yyyyyyyyyyyy
+yyyyyyyyyy
+yyyyyyyy
+yyyyyy
+yyyy
+yy
+
+\pset format aligned
+execute q;
+* Record 1
+ a xx
++
++b
+ a yyyyyyyyyyyyyyyyyy
++b
+* Record 2
+ a xxxx
++ xxxxxx
++b xxxxxxxx
+ xxxxxxxxxx
+ xxxxxxxxxxxx
+ xxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxxxx
+ a yyyyyyyyyyyyyyyy
++b yyyyyyyyyyyyyy
+ yyyyyyyyyyyy
+ yyyyyyyyyy
+ yyyyyyyy
+ yyyyyy
+ yyyy
+ yy
+
+
+\pset format wrapped
+execute q;
+* Record 1
+ a xx
++
++b
+ a yyyyyyyyyyyyyyyyyy
++b
+* Record 2
+ a xxxx
++ xxxxxx
++b xxxxxxxx
+ xxxxxxxxxx
+ xxxxxxxxxxxx
+ xxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxx
+ xxxxxxxxxxxxxxxxxx
+ xx
+ a yyyyyyyyyyyyyyyy
++b yyyyyyyyyyyyyy
+ yyyyyyyyyyyy
+ yyyyyyyyyy
+ yyyyyyyy
+ yyyyyy
+ yyyy
+ yy
+
+
+\pset border 1
+\pset format unaligned
+execute q;
+a
+
+b|xx
+a
+b|yyyyyyyyyyyyyyyyyy
+
+a
+
+b|xxxx
+xxxxxx
+xxxxxxxx
+xxxxxxxxxx
+xxxxxxxxxxxx
+xxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxx
+a
+b|yyyyyyyyyyyyyyyy
+yyyyyyyyyyyyyy
+yyyyyyyyyyyy
+yyyyyyyyyy
+yyyyyyyy
+yyyyyy
+yyyy
+yy
+
+\pset format aligned
+execute q;
+-[ RECORD 1 ]-----------
+ a | xx
++ ;
++b ;
+ a | yyyyyyyyyyyyyyyyyy
++b ;
+-[ RECORD 2 ]-----------
+ a | xxxx
++ : xxxxxx
++b : xxxxxxxx
+ : xxxxxxxxxx
+ : xxxxxxxxxxxx
+ : xxxxxxxxxxxxxx
+ : xxxxxxxxxxxxxxxx
+ : xxxxxxxxxxxxxxxxxx
+ : xxxxxxxxxxxxxxxxxxxx
+ a | yyyyyyyyyyyyyyyy
++b : yyyyyyyyyyyyyy
+ : yyyyyyyyyyyy
+ : yyyyyyyyyy
+ : yyyyyyyy
+ : yyyyyy
+ : yyyy
+ : yy
+ :
+
+\pset format wrapped
+execute q;
+-[ RECORD 1 ]-------
+ a | xx
++ ;
++b ;
+ a | yyyyyyyyyyyyyyyy
++b ; yy
+-[ RECORD 2 ]-------
+ a | xxxx
++ : xxxxxx
++b : xxxxxxxx
+ : xxxxxxxxxx
+ : xxxxxxxxxxxx
+ : xxxxxxxxxxxxxx
+ : xxxxxxxxxxxxxxxx
+ : xxxxxxxxxxxxxxxx
+ ; xx
+ : xxxxxxxxxxxxxxxx
+ ; xxxx
+ a | yyyyyyyyyyyyyyyy
++b : yyyyyyyyyyyyyy
+ : yyyyyyyyyyyy
+ : yyyyyyyyyy
+ : yyyyyyyy
+ : yyyyyy
+ : yyyy
+ : yy
+ :
+
+\pset border 2
+\pset format unaligned
+execute q;
+a
+
+b|xx
+a
+b|yyyyyyyyyyyyyyyyyy
+
+a
+
+b|xxxx
+xxxxxx
+xxxxxxxx
+xxxxxxxxxx
+xxxxxxxxxxxx
+xxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxx
+a
+b|yyyyyyyyyyyyyyyy
+yyyyyyyyyyyyyy
+yyyyyyyyyyyy
+yyyyyyyyyy
+yyyyyyyy
+yyyyyy
+yyyy
+yy
+
+\pset format aligned
+execute q;
++-[ RECORD 1 ]-------------+
+| a | xx |
+|+ ; |
+|+b ; |
+| a | yyyyyyyyyyyyyyyyyy |
+|+b ; |
++-[ RECORD 2 ]-------------+
+| a | xxxx |
+|+ : xxxxxx |
+|+b : xxxxxxxx |
+| : xxxxxxxxxx |
+| : xxxxxxxxxxxx |
+| : xxxxxxxxxxxxxx |
+| : xxxxxxxxxxxxxxxx |
+| : xxxxxxxxxxxxxxxxxx |
+| : xxxxxxxxxxxxxxxxxxxx |
+| a | yyyyyyyyyyyyyyyy |
+|+b : yyyyyyyyyyyyyy |
+| : yyyyyyyyyyyy |
+| : yyyyyyyyyy |
+| : yyyyyyyy |
+| : yyyyyy |
+| : yyyy |
+| : yy |
+| : |
++---+----------------------+
+
+\pset format wrapped
+execute q;
++-[ RECORD 1 ]-----+
+| a | xx |
+|+ ; |
+|+b ; |
+| a | yyyyyyyyyyyy |
+|+b ; yyyyyy |
++-[ RECORD 2 ]-----+
+| a | xxxx |
+|+ : xxxxxx |
+|+b : xxxxxxxx |
+| : xxxxxxxxxx |
+| : xxxxxxxxxxxx |
+| : xxxxxxxxxxxx |
+| ; xx |
+| : xxxxxxxxxxxx |
+| ; xxxx |
+| : xxxxxxxxxxxx |
+| ; xxxxxx |
+| : xxxxxxxxxxxx |
+| ; xxxxxxxx |
+| a | yyyyyyyyyyyy |
+|+b ; yyyy |
+| : yyyyyyyyyyyy |
+| ; yy |
+| : yyyyyyyyyyyy |
+| : yyyyyyyyyy |
+| : yyyyyyyy |
+| : yyyyyy |
+| : yyyy |
+| : yy |
+| : |
++---+--------------+
+
+deallocate q;
diff --git a/src/test/regress/sql/psql.sql b/src/test/regress/sql/psql.sql
index 99ad5b4a70b..a7d5eeb587a 100644
--- a/src/test/regress/sql/psql.sql
+++ b/src/test/regress/sql/psql.sql
@@ -40,3 +40,123 @@ select 10 as test01, 20 as test02 from generate_series(1,0) \gset
-- show all pset options
\pset
+
+-- test multi-line headers, wrapping, and newline indicators
+prepare q as select array_to_string(array_agg(repeat('x',2*n)),E'\n') as "a
+
+b", array_to_string(array_agg(repeat('y',20-2*n)),E'\n') as "a
+b" from generate_series(1,10) as n(n) group by n>1 ;
+
+\pset linestyle ascii
+
+\pset expanded off
+\pset columns 40
+
+\pset border 0
+\pset format unaligned
+execute q;
+\pset format aligned
+execute q;
+\pset format wrapped
+execute q;
+
+\pset border 1
+\pset format unaligned
+execute q;
+\pset format aligned
+execute q;
+\pset format wrapped
+execute q;
+
+\pset border 2
+\pset format unaligned
+execute q;
+\pset format aligned
+execute q;
+\pset format wrapped
+execute q;
+
+\pset expanded on
+\pset columns 20
+
+\pset border 0
+\pset format unaligned
+execute q;
+\pset format aligned
+execute q;
+\pset format wrapped
+execute q;
+
+\pset border 1
+\pset format unaligned
+execute q;
+\pset format aligned
+execute q;
+\pset format wrapped
+execute q;
+
+\pset border 2
+\pset format unaligned
+execute q;
+\pset format aligned
+execute q;
+\pset format wrapped
+execute q;
+
+\pset linestyle old-ascii
+
+\pset expanded off
+\pset columns 40
+
+\pset border 0
+\pset format unaligned
+execute q;
+\pset format aligned
+execute q;
+\pset format wrapped
+execute q;
+
+\pset border 1
+\pset format unaligned
+execute q;
+\pset format aligned
+execute q;
+\pset format wrapped
+execute q;
+
+\pset border 2
+\pset format unaligned
+execute q;
+\pset format aligned
+execute q;
+\pset format wrapped
+execute q;
+
+\pset expanded on
+\pset columns 20
+
+\pset border 0
+\pset format unaligned
+execute q;
+\pset format aligned
+execute q;
+\pset format wrapped
+execute q;
+
+\pset border 1
+\pset format unaligned
+execute q;
+\pset format aligned
+execute q;
+\pset format wrapped
+execute q;
+
+\pset border 2
+\pset format unaligned
+execute q;
+\pset format aligned
+execute q;
+\pset format wrapped
+execute q;
+
+deallocate q;