1--
2-- Tests for psql features that aren't closely connected to any
3-- specific server features
4--
5-- \set
6-- fail: invalid name
7\set invalid/name foo
8invalid variable name: "invalid/name"
9-- fail: invalid value for special variable
10\set AUTOCOMMIT foo
11unrecognized value "foo" for "AUTOCOMMIT": Boolean expected
12\set FETCH_COUNT foo
13invalid value "foo" for "FETCH_COUNT": integer expected
14-- check handling of built-in boolean variable
15\echo :ON_ERROR_ROLLBACK
16off
17\set ON_ERROR_ROLLBACK
18\echo :ON_ERROR_ROLLBACK
19on
20\set ON_ERROR_ROLLBACK foo
21unrecognized value "foo" for "ON_ERROR_ROLLBACK"
22Available values are: on, off, interactive.
23\echo :ON_ERROR_ROLLBACK
24on
25\set ON_ERROR_ROLLBACK on
26\echo :ON_ERROR_ROLLBACK
27on
28\unset ON_ERROR_ROLLBACK
29\echo :ON_ERROR_ROLLBACK
30off
31-- \g and \gx
32SELECT 1 as one, 2 as two \g
33 one | two
34-----+-----
35   1 |   2
36(1 row)
37
38\gx
39-[ RECORD 1 ]
40one | 1
41two | 2
42
43SELECT 3 as three, 4 as four \gx
44-[ RECORD 1 ]
45three | 3
46four  | 4
47
48\g
49 three | four
50-------+------
51     3 |    4
52(1 row)
53
54-- \gx should work in FETCH_COUNT mode too
55\set FETCH_COUNT 1
56SELECT 1 as one, 2 as two \g
57 one | two
58-----+-----
59   1 |   2
60(1 row)
61
62\gx
63-[ RECORD 1 ]
64one | 1
65two | 2
66
67SELECT 3 as three, 4 as four \gx
68-[ RECORD 1 ]
69three | 3
70four  | 4
71
72\g
73 three | four
74-------+------
75     3 |    4
76(1 row)
77
78\unset FETCH_COUNT
79-- \gset
80select 10 as test01, 20 as test02, 'Hello' as test03 \gset pref01_
81\echo :pref01_test01 :pref01_test02 :pref01_test03
8210 20 Hello
83-- should fail: bad variable name
84select 10 as "bad name"
85\gset
86invalid variable name: "bad name"
87select 97 as "EOF", 'ok' as _foo \gset IGNORE
88attempt to \gset into specially treated variable "IGNOREEOF" ignored
89\echo :IGNORE_foo :IGNOREEOF
90ok 0
91-- multiple backslash commands in one line
92select 1 as x, 2 as y \gset pref01_ \\ \echo :pref01_x
931
94select 3 as x, 4 as y \gset pref01_ \echo :pref01_x \echo :pref01_y
953
964
97select 5 as x, 6 as y \gset pref01_ \\ \g \echo :pref01_x :pref01_y
98 x | y
99---+---
100 5 | 6
101(1 row)
102
1035 6
104select 7 as x, 8 as y \g \gset pref01_ \echo :pref01_x :pref01_y
105 x | y
106---+---
107 7 | 8
108(1 row)
109
1107 8
111-- NULL should unset the variable
112\set var2 xyz
113select 1 as var1, NULL as var2, 3 as var3 \gset
114\echo :var1 :var2 :var3
1151 :var2 3
116-- \gset requires just one tuple
117select 10 as test01, 20 as test02 from generate_series(1,3) \gset
118more than one row returned for \gset
119select 10 as test01, 20 as test02 from generate_series(1,0) \gset
120no rows returned for \gset
121-- \gset should work in FETCH_COUNT mode too
122\set FETCH_COUNT 1
123select 1 as x, 2 as y \gset pref01_ \\ \echo :pref01_x
1241
125select 3 as x, 4 as y \gset pref01_ \echo :pref01_x \echo :pref01_y
1263
1274
128select 10 as test01, 20 as test02 from generate_series(1,3) \gset
129more than one row returned for \gset
130select 10 as test01, 20 as test02 from generate_series(1,0) \gset
131no rows returned for \gset
132\unset FETCH_COUNT
133-- \gexec
134create temporary table gexec_test(a int, b text, c date, d float);
135select format('create index on gexec_test(%I)', attname)
136from pg_attribute
137where attrelid = 'gexec_test'::regclass and attnum > 0
138order by attnum
139\gexec
140create index on gexec_test(a)
141create index on gexec_test(b)
142create index on gexec_test(c)
143create index on gexec_test(d)
144-- \gexec should work in FETCH_COUNT mode too
145-- (though the fetch limit applies to the executed queries not the meta query)
146\set FETCH_COUNT 1
147select 'select 1 as ones', 'select x.y, x.y*2 as double from generate_series(1,4) as x(y)'
148union all
149select 'drop table gexec_test', NULL
150union all
151select 'drop table gexec_test', 'select ''2000-01-01''::date as party_over'
152\gexec
153select 1 as ones
154 ones
155------
156    1
157(1 row)
158
159select x.y, x.y*2 as double from generate_series(1,4) as x(y)
160 y | double
161---+--------
162 1 |      2
163 2 |      4
164 3 |      6
165 4 |      8
166(4 rows)
167
168drop table gexec_test
169drop table gexec_test
170ERROR:  table "gexec_test" does not exist
171select '2000-01-01'::date as party_over
172 party_over
173------------
174 01-01-2000
175(1 row)
176
177\unset FETCH_COUNT
178-- show all pset options
179\pset
180border                   1
181columns                  0
182expanded                 off
183fieldsep                 '|'
184fieldsep_zero            off
185footer                   on
186format                   aligned
187linestyle                ascii
188null                     ''
189numericlocale            off
190pager                    1
191pager_min_lines          0
192recordsep                '\n'
193recordsep_zero           off
194tableattr
195title
196tuples_only              off
197unicode_border_linestyle single
198unicode_column_linestyle single
199unicode_header_linestyle single
200-- test multi-line headers, wrapping, and newline indicators
201prepare q as select array_to_string(array_agg(repeat('x',2*n)),E'\n') as "ab
202
203c", array_to_string(array_agg(repeat('y',20-2*n)),E'\n') as "a
204bc" from generate_series(1,10) as n(n) group by n>1 order by n>1;
205\pset linestyle ascii
206\pset expanded off
207\pset columns 40
208\pset border 0
209\pset format unaligned
210execute q;
211ab
212
213c|a
214bc
215xx|yyyyyyyyyyyyyyyyyy
216xxxx
217xxxxxx
218xxxxxxxx
219xxxxxxxxxx
220xxxxxxxxxxxx
221xxxxxxxxxxxxxx
222xxxxxxxxxxxxxxxx
223xxxxxxxxxxxxxxxxxx
224xxxxxxxxxxxxxxxxxxxx|yyyyyyyyyyyyyyyy
225yyyyyyyyyyyyyy
226yyyyyyyyyyyy
227yyyyyyyyyy
228yyyyyyyy
229yyyyyy
230yyyy
231yy
232
233(2 rows)
234\pset format aligned
235execute q;
236         ab         +        a         +
237                    +        bc
238         c
239-------------------- ------------------
240xx                   yyyyyyyyyyyyyyyyyy
241xxxx                +yyyyyyyyyyyyyyyy  +
242xxxxxx              +yyyyyyyyyyyyyy    +
243xxxxxxxx            +yyyyyyyyyyyy      +
244xxxxxxxxxx          +yyyyyyyyyy        +
245xxxxxxxxxxxx        +yyyyyyyy          +
246xxxxxxxxxxxxxx      +yyyyyy            +
247xxxxxxxxxxxxxxxx    +yyyy              +
248xxxxxxxxxxxxxxxxxx  +yy                +
249xxxxxxxxxxxxxxxxxxxx
250(2 rows)
251
252\pset format wrapped
253execute q;
254         ab         +        a         +
255                    +        bc
256         c
257-------------------- ------------------
258xx                   yyyyyyyyyyyyyyyyyy
259xxxx                +yyyyyyyyyyyyyyyy  +
260xxxxxx              +yyyyyyyyyyyyyy    +
261xxxxxxxx            +yyyyyyyyyyyy      +
262xxxxxxxxxx          +yyyyyyyyyy        +
263xxxxxxxxxxxx        +yyyyyyyy          +
264xxxxxxxxxxxxxx      +yyyyyy            +
265xxxxxxxxxxxxxxxx    +yyyy              +
266xxxxxxxxxxxxxxxxxx  +yy                +
267xxxxxxxxxxxxxxxxxxxx
268(2 rows)
269
270\pset border 1
271\pset format unaligned
272execute q;
273ab
274
275c|a
276bc
277xx|yyyyyyyyyyyyyyyyyy
278xxxx
279xxxxxx
280xxxxxxxx
281xxxxxxxxxx
282xxxxxxxxxxxx
283xxxxxxxxxxxxxx
284xxxxxxxxxxxxxxxx
285xxxxxxxxxxxxxxxxxx
286xxxxxxxxxxxxxxxxxxxx|yyyyyyyyyyyyyyyy
287yyyyyyyyyyyyyy
288yyyyyyyyyyyy
289yyyyyyyyyy
290yyyyyyyy
291yyyyyy
292yyyy
293yy
294
295(2 rows)
296\pset format aligned
297execute q;
298          ab         +|         a         +
299                     +|         bc
300          c           |
301----------------------+--------------------
302 xx                   | yyyyyyyyyyyyyyyyyy
303 xxxx                +| yyyyyyyyyyyyyyyy  +
304 xxxxxx              +| yyyyyyyyyyyyyy    +
305 xxxxxxxx            +| yyyyyyyyyyyy      +
306 xxxxxxxxxx          +| yyyyyyyyyy        +
307 xxxxxxxxxxxx        +| yyyyyyyy          +
308 xxxxxxxxxxxxxx      +| yyyyyy            +
309 xxxxxxxxxxxxxxxx    +| yyyy              +
310 xxxxxxxxxxxxxxxxxx  +| yy                +
311 xxxxxxxxxxxxxxxxxxxx |
312(2 rows)
313
314\pset format wrapped
315execute q;
316        ab        +|         a         +
317                  +|         bc
318         c         |
319-------------------+--------------------
320 xx                | yyyyyyyyyyyyyyyyyy
321 xxxx             +| yyyyyyyyyyyyyyyy  +
322 xxxxxx           +| yyyyyyyyyyyyyy    +
323 xxxxxxxx         +| yyyyyyyyyyyy      +
324 xxxxxxxxxx       +| yyyyyyyyyy        +
325 xxxxxxxxxxxx     +| yyyyyyyy          +
326 xxxxxxxxxxxxxx   +| yyyyyy            +
327 xxxxxxxxxxxxxxxx +| yyyy              +
328 xxxxxxxxxxxxxxxxx.| yy                +
329.x                +|
330 xxxxxxxxxxxxxxxxx.|
331.xxx               |
332(2 rows)
333
334\pset border 2
335\pset format unaligned
336execute q;
337ab
338
339c|a
340bc
341xx|yyyyyyyyyyyyyyyyyy
342xxxx
343xxxxxx
344xxxxxxxx
345xxxxxxxxxx
346xxxxxxxxxxxx
347xxxxxxxxxxxxxx
348xxxxxxxxxxxxxxxx
349xxxxxxxxxxxxxxxxxx
350xxxxxxxxxxxxxxxxxxxx|yyyyyyyyyyyyyyyy
351yyyyyyyyyyyyyy
352yyyyyyyyyyyy
353yyyyyyyyyy
354yyyyyyyy
355yyyyyy
356yyyy
357yy
358
359(2 rows)
360\pset format aligned
361execute q;
362+----------------------+--------------------+
363|          ab         +|         a         +|
364|                     +|         bc         |
365|          c           |                    |
366+----------------------+--------------------+
367| xx                   | yyyyyyyyyyyyyyyyyy |
368| xxxx                +| yyyyyyyyyyyyyyyy  +|
369| xxxxxx              +| yyyyyyyyyyyyyy    +|
370| xxxxxxxx            +| yyyyyyyyyyyy      +|
371| xxxxxxxxxx          +| yyyyyyyyyy        +|
372| xxxxxxxxxxxx        +| yyyyyyyy          +|
373| xxxxxxxxxxxxxx      +| yyyyyy            +|
374| xxxxxxxxxxxxxxxx    +| yyyy              +|
375| xxxxxxxxxxxxxxxxxx  +| yy                +|
376| xxxxxxxxxxxxxxxxxxxx |                    |
377+----------------------+--------------------+
378(2 rows)
379
380\pset format wrapped
381execute q;
382+-----------------+--------------------+
383|       ab       +|         a         +|
384|                +|         bc         |
385|        c        |                    |
386+-----------------+--------------------+
387| xx              | yyyyyyyyyyyyyyyyyy |
388| xxxx           +| yyyyyyyyyyyyyyyy  +|
389| xxxxxx         +| yyyyyyyyyyyyyy    +|
390| xxxxxxxx       +| yyyyyyyyyyyy      +|
391| xxxxxxxxxx     +| yyyyyyyyyy        +|
392| xxxxxxxxxxxx   +| yyyyyyyy          +|
393| xxxxxxxxxxxxxx +| yyyyyy            +|
394| xxxxxxxxxxxxxxx.| yyyy              +|
395|.x              +| yy                +|
396| xxxxxxxxxxxxxxx.|                    |
397|.xxx            +|                    |
398| xxxxxxxxxxxxxxx.|                    |
399|.xxxxx           |                    |
400+-----------------+--------------------+
401(2 rows)
402
403\pset expanded on
404\pset columns 20
405\pset border 0
406\pset format unaligned
407execute q;
408ab
409
410c|xx
411a
412bc|yyyyyyyyyyyyyyyyyy
413
414ab
415
416c|xxxx
417xxxxxx
418xxxxxxxx
419xxxxxxxxxx
420xxxxxxxxxxxx
421xxxxxxxxxxxxxx
422xxxxxxxxxxxxxxxx
423xxxxxxxxxxxxxxxxxx
424xxxxxxxxxxxxxxxxxxxx
425a
426bc|yyyyyyyyyyyyyyyy
427yyyyyyyyyyyyyy
428yyyyyyyyyyyy
429yyyyyyyyyy
430yyyyyyyy
431yyyyyy
432yyyy
433yy
434
435\pset format aligned
436execute q;
437* Record 1
438ab+ xx
439  +
440c
441a + yyyyyyyyyyyyyyyyyy
442bc
443* Record 2
444ab+ xxxx                +
445  + xxxxxx              +
446c   xxxxxxxx            +
447    xxxxxxxxxx          +
448    xxxxxxxxxxxx        +
449    xxxxxxxxxxxxxx      +
450    xxxxxxxxxxxxxxxx    +
451    xxxxxxxxxxxxxxxxxx  +
452    xxxxxxxxxxxxxxxxxxxx
453a + yyyyyyyyyyyyyyyy    +
454bc  yyyyyyyyyyyyyy      +
455    yyyyyyyyyyyy        +
456    yyyyyyyyyy          +
457    yyyyyyyy            +
458    yyyyyy              +
459    yyyy                +
460    yy                  +
461
462
463\pset format wrapped
464execute q;
465* Record 1
466ab+ xx
467  +
468c
469a + yyyyyyyyyyyyyyy.
470bc .yyy
471* Record 2
472ab+ xxxx           +
473  + xxxxxx         +
474c   xxxxxxxx       +
475    xxxxxxxxxx     +
476    xxxxxxxxxxxx   +
477    xxxxxxxxxxxxxx +
478    xxxxxxxxxxxxxxx.
479   .x              +
480    xxxxxxxxxxxxxxx.
481   .xxx            +
482    xxxxxxxxxxxxxxx.
483   .xxxxx
484a + yyyyyyyyyyyyyyy.
485bc .y              +
486    yyyyyyyyyyyyyy +
487    yyyyyyyyyyyy   +
488    yyyyyyyyyy     +
489    yyyyyyyy       +
490    yyyyyy         +
491    yyyy           +
492    yy             +
493
494
495\pset border 1
496\pset format unaligned
497execute q;
498ab
499
500c|xx
501a
502bc|yyyyyyyyyyyyyyyyyy
503
504ab
505
506c|xxxx
507xxxxxx
508xxxxxxxx
509xxxxxxxxxx
510xxxxxxxxxxxx
511xxxxxxxxxxxxxx
512xxxxxxxxxxxxxxxx
513xxxxxxxxxxxxxxxxxx
514xxxxxxxxxxxxxxxxxxxx
515a
516bc|yyyyyyyyyyyyyyyy
517yyyyyyyyyyyyyy
518yyyyyyyyyyyy
519yyyyyyyyyy
520yyyyyyyy
521yyyyyy
522yyyy
523yy
524
525\pset format aligned
526execute q;
527-[ RECORD 1 ]------------
528ab+| xx
529  +|
530c  |
531a +| yyyyyyyyyyyyyyyyyy
532bc |
533-[ RECORD 2 ]------------
534ab+| xxxx                +
535  +| xxxxxx              +
536c  | xxxxxxxx            +
537   | xxxxxxxxxx          +
538   | xxxxxxxxxxxx        +
539   | xxxxxxxxxxxxxx      +
540   | xxxxxxxxxxxxxxxx    +
541   | xxxxxxxxxxxxxxxxxx  +
542   | xxxxxxxxxxxxxxxxxxxx
543a +| yyyyyyyyyyyyyyyy    +
544bc | yyyyyyyyyyyyyy      +
545   | yyyyyyyyyyyy        +
546   | yyyyyyyyyy          +
547   | yyyyyyyy            +
548   | yyyyyy              +
549   | yyyy                +
550   | yy                  +
551   |
552
553\pset format wrapped
554execute q;
555-[ RECORD 1 ]------
556ab+| xx
557  +|
558c  |
559a +| yyyyyyyyyyyyyy.
560bc |.yyyy
561-[ RECORD 2 ]------
562ab+| xxxx          +
563  +| xxxxxx        +
564c  | xxxxxxxx      +
565   | xxxxxxxxxx    +
566   | xxxxxxxxxxxx  +
567   | xxxxxxxxxxxxxx+
568   | xxxxxxxxxxxxxx.
569   |.xx            +
570   | xxxxxxxxxxxxxx.
571   |.xxxx          +
572   | xxxxxxxxxxxxxx.
573   |.xxxxxx
574a +| yyyyyyyyyyyyyy.
575bc |.yy            +
576   | yyyyyyyyyyyyyy+
577   | yyyyyyyyyyyy  +
578   | yyyyyyyyyy    +
579   | yyyyyyyy      +
580   | yyyyyy        +
581   | yyyy          +
582   | yy            +
583   |
584
585\pset border 2
586\pset format unaligned
587execute q;
588ab
589
590c|xx
591a
592bc|yyyyyyyyyyyyyyyyyy
593
594ab
595
596c|xxxx
597xxxxxx
598xxxxxxxx
599xxxxxxxxxx
600xxxxxxxxxxxx
601xxxxxxxxxxxxxx
602xxxxxxxxxxxxxxxx
603xxxxxxxxxxxxxxxxxx
604xxxxxxxxxxxxxxxxxxxx
605a
606bc|yyyyyyyyyyyyyyyy
607yyyyyyyyyyyyyy
608yyyyyyyyyyyy
609yyyyyyyyyy
610yyyyyyyy
611yyyyyy
612yyyy
613yy
614
615\pset format aligned
616execute q;
617+-[ RECORD 1 ]--------------+
618| ab+| xx                   |
619|   +|                      |
620| c  |                      |
621| a +| yyyyyyyyyyyyyyyyyy   |
622| bc |                      |
623+-[ RECORD 2 ]--------------+
624| ab+| xxxx                +|
625|   +| xxxxxx              +|
626| c  | xxxxxxxx            +|
627|    | xxxxxxxxxx          +|
628|    | xxxxxxxxxxxx        +|
629|    | xxxxxxxxxxxxxx      +|
630|    | xxxxxxxxxxxxxxxx    +|
631|    | xxxxxxxxxxxxxxxxxx  +|
632|    | xxxxxxxxxxxxxxxxxxxx |
633| a +| yyyyyyyyyyyyyyyy    +|
634| bc | yyyyyyyyyyyyyy      +|
635|    | yyyyyyyyyyyy        +|
636|    | yyyyyyyyyy          +|
637|    | yyyyyyyy            +|
638|    | yyyyyy              +|
639|    | yyyy                +|
640|    | yy                  +|
641|    |                      |
642+----+----------------------+
643
644\pset format wrapped
645execute q;
646+-[ RECORD 1 ]-----+
647| ab+| xx          |
648|   +|             |
649| c  |             |
650| a +| yyyyyyyyyyy.|
651| bc |.yyyyyyy     |
652+-[ RECORD 2 ]-----+
653| ab+| xxxx       +|
654|   +| xxxxxx     +|
655| c  | xxxxxxxx   +|
656|    | xxxxxxxxxx +|
657|    | xxxxxxxxxxx.|
658|    |.x          +|
659|    | xxxxxxxxxxx.|
660|    |.xxx        +|
661|    | xxxxxxxxxxx.|
662|    |.xxxxx      +|
663|    | xxxxxxxxxxx.|
664|    |.xxxxxxx    +|
665|    | xxxxxxxxxxx.|
666|    |.xxxxxxxxx   |
667| a +| yyyyyyyyyyy.|
668| bc |.yyyyy      +|
669|    | yyyyyyyyyyy.|
670|    |.yyy        +|
671|    | yyyyyyyyyyy.|
672|    |.y          +|
673|    | yyyyyyyyyy +|
674|    | yyyyyyyy   +|
675|    | yyyyyy     +|
676|    | yyyy       +|
677|    | yy         +|
678|    |             |
679+----+-------------+
680
681\pset linestyle old-ascii
682\pset expanded off
683\pset columns 40
684\pset border 0
685\pset format unaligned
686execute q;
687ab
688
689c|a
690bc
691xx|yyyyyyyyyyyyyyyyyy
692xxxx
693xxxxxx
694xxxxxxxx
695xxxxxxxxxx
696xxxxxxxxxxxx
697xxxxxxxxxxxxxx
698xxxxxxxxxxxxxxxx
699xxxxxxxxxxxxxxxxxx
700xxxxxxxxxxxxxxxxxxxx|yyyyyyyyyyyyyyyy
701yyyyyyyyyyyyyy
702yyyyyyyyyyyy
703yyyyyyyyyy
704yyyyyyyy
705yyyyyy
706yyyy
707yy
708
709(2 rows)
710\pset format aligned
711execute q;
712         ab                  a
713                    +        bc
714         c          +
715-------------------- ------------------
716xx                   yyyyyyyyyyyyyyyyyy
717xxxx                 yyyyyyyyyyyyyyyy
718xxxxxx               yyyyyyyyyyyyyy
719xxxxxxxx             yyyyyyyyyyyy
720xxxxxxxxxx           yyyyyyyyyy
721xxxxxxxxxxxx         yyyyyyyy
722xxxxxxxxxxxxxx       yyyyyy
723xxxxxxxxxxxxxxxx     yyyy
724xxxxxxxxxxxxxxxxxx   yy
725xxxxxxxxxxxxxxxxxxxx
726(2 rows)
727
728\pset format wrapped
729execute q;
730         ab                  a
731                    +        bc
732         c          +
733-------------------- ------------------
734xx                   yyyyyyyyyyyyyyyyyy
735xxxx                 yyyyyyyyyyyyyyyy
736xxxxxx               yyyyyyyyyyyyyy
737xxxxxxxx             yyyyyyyyyyyy
738xxxxxxxxxx           yyyyyyyyyy
739xxxxxxxxxxxx         yyyyyyyy
740xxxxxxxxxxxxxx       yyyyyy
741xxxxxxxxxxxxxxxx     yyyy
742xxxxxxxxxxxxxxxxxx   yy
743xxxxxxxxxxxxxxxxxxxx
744(2 rows)
745
746\pset border 1
747\pset format unaligned
748execute q;
749ab
750
751c|a
752bc
753xx|yyyyyyyyyyyyyyyyyy
754xxxx
755xxxxxx
756xxxxxxxx
757xxxxxxxxxx
758xxxxxxxxxxxx
759xxxxxxxxxxxxxx
760xxxxxxxxxxxxxxxx
761xxxxxxxxxxxxxxxxxx
762xxxxxxxxxxxxxxxxxxxx|yyyyyyyyyyyyyyyy
763yyyyyyyyyyyyyy
764yyyyyyyyyyyy
765yyyyyyyyyy
766yyyyyyyy
767yyyyyy
768yyyy
769yy
770
771(2 rows)
772\pset format aligned
773execute q;
774          ab          |         a
775+                     |+        bc
776+         c           |+
777----------------------+--------------------
778 xx                   | yyyyyyyyyyyyyyyyyy
779 xxxx                 | yyyyyyyyyyyyyyyy
780 xxxxxx               : yyyyyyyyyyyyyy
781 xxxxxxxx             : yyyyyyyyyyyy
782 xxxxxxxxxx           : yyyyyyyyyy
783 xxxxxxxxxxxx         : yyyyyyyy
784 xxxxxxxxxxxxxx       : yyyyyy
785 xxxxxxxxxxxxxxxx     : yyyy
786 xxxxxxxxxxxxxxxxxx   : yy
787 xxxxxxxxxxxxxxxxxxxx :
788(2 rows)
789
790\pset format wrapped
791execute q;
792        ab         |         a
793+                  |+        bc
794+        c         |+
795-------------------+--------------------
796 xx                | yyyyyyyyyyyyyyyyyy
797 xxxx              | yyyyyyyyyyyyyyyy
798 xxxxxx            : yyyyyyyyyyyyyy
799 xxxxxxxx          : yyyyyyyyyyyy
800 xxxxxxxxxx        : yyyyyyyyyy
801 xxxxxxxxxxxx      : yyyyyyyy
802 xxxxxxxxxxxxxx    : yyyyyy
803 xxxxxxxxxxxxxxxx  : yyyy
804 xxxxxxxxxxxxxxxxx : yy
805 x                 :
806 xxxxxxxxxxxxxxxxx
807 xxx
808(2 rows)
809
810\pset border 2
811\pset format unaligned
812execute q;
813ab
814
815c|a
816bc
817xx|yyyyyyyyyyyyyyyyyy
818xxxx
819xxxxxx
820xxxxxxxx
821xxxxxxxxxx
822xxxxxxxxxxxx
823xxxxxxxxxxxxxx
824xxxxxxxxxxxxxxxx
825xxxxxxxxxxxxxxxxxx
826xxxxxxxxxxxxxxxxxxxx|yyyyyyyyyyyyyyyy
827yyyyyyyyyyyyyy
828yyyyyyyyyyyy
829yyyyyyyyyy
830yyyyyyyy
831yyyyyy
832yyyy
833yy
834
835(2 rows)
836\pset format aligned
837execute q;
838+----------------------+--------------------+
839|          ab          |         a          |
840|+                     |+        bc         |
841|+         c           |+                   |
842+----------------------+--------------------+
843| xx                   | yyyyyyyyyyyyyyyyyy |
844| xxxx                 | yyyyyyyyyyyyyyyy   |
845| xxxxxx               : yyyyyyyyyyyyyy     |
846| xxxxxxxx             : yyyyyyyyyyyy       |
847| xxxxxxxxxx           : yyyyyyyyyy         |
848| xxxxxxxxxxxx         : yyyyyyyy           |
849| xxxxxxxxxxxxxx       : yyyyyy             |
850| xxxxxxxxxxxxxxxx     : yyyy               |
851| xxxxxxxxxxxxxxxxxx   : yy                 |
852| xxxxxxxxxxxxxxxxxxxx :                    |
853+----------------------+--------------------+
854(2 rows)
855
856\pset format wrapped
857execute q;
858+-----------------+--------------------+
859|       ab        |         a          |
860|+                |+        bc         |
861|+       c        |+                   |
862+-----------------+--------------------+
863| xx              | yyyyyyyyyyyyyyyyyy |
864| xxxx            | yyyyyyyyyyyyyyyy   |
865| xxxxxx          : yyyyyyyyyyyyyy     |
866| xxxxxxxx        : yyyyyyyyyyyy       |
867| xxxxxxxxxx      : yyyyyyyyyy         |
868| xxxxxxxxxxxx    : yyyyyyyy           |
869| xxxxxxxxxxxxxx  : yyyyyy             |
870| xxxxxxxxxxxxxxx : yyyy               |
871| x               : yy                 |
872| xxxxxxxxxxxxxxx :                    |
873| xxx                                  |
874| xxxxxxxxxxxxxxx                      |
875| xxxxx                                |
876+-----------------+--------------------+
877(2 rows)
878
879\pset expanded on
880\pset columns 20
881\pset border 0
882\pset format unaligned
883execute q;
884ab
885
886c|xx
887a
888bc|yyyyyyyyyyyyyyyyyy
889
890ab
891
892c|xxxx
893xxxxxx
894xxxxxxxx
895xxxxxxxxxx
896xxxxxxxxxxxx
897xxxxxxxxxxxxxx
898xxxxxxxxxxxxxxxx
899xxxxxxxxxxxxxxxxxx
900xxxxxxxxxxxxxxxxxxxx
901a
902bc|yyyyyyyyyyyyyyyy
903yyyyyyyyyyyyyy
904yyyyyyyyyyyy
905yyyyyyyyyy
906yyyyyyyy
907yyyyyy
908yyyy
909yy
910
911\pset format aligned
912execute q;
913* Record 1
914 ab xx
915+
916+c
917 a  yyyyyyyyyyyyyyyyyy
918+bc
919* Record 2
920 ab xxxx
921+   xxxxxx
922+c  xxxxxxxx
923    xxxxxxxxxx
924    xxxxxxxxxxxx
925    xxxxxxxxxxxxxx
926    xxxxxxxxxxxxxxxx
927    xxxxxxxxxxxxxxxxxx
928    xxxxxxxxxxxxxxxxxxxx
929 a  yyyyyyyyyyyyyyyy
930+bc yyyyyyyyyyyyyy
931    yyyyyyyyyyyy
932    yyyyyyyyyy
933    yyyyyyyy
934    yyyyyy
935    yyyy
936    yy
937
938
939\pset format wrapped
940execute q;
941* Record 1
942 ab xx
943+
944+c
945 a  yyyyyyyyyyyyyyyy
946+bc yy
947* Record 2
948 ab xxxx
949+   xxxxxx
950+c  xxxxxxxx
951    xxxxxxxxxx
952    xxxxxxxxxxxx
953    xxxxxxxxxxxxxx
954    xxxxxxxxxxxxxxxx
955    xxxxxxxxxxxxxxxx
956    xx
957    xxxxxxxxxxxxxxxx
958    xxxx
959 a  yyyyyyyyyyyyyyyy
960+bc yyyyyyyyyyyyyy
961    yyyyyyyyyyyy
962    yyyyyyyyyy
963    yyyyyyyy
964    yyyyyy
965    yyyy
966    yy
967
968
969\pset border 1
970\pset format unaligned
971execute q;
972ab
973
974c|xx
975a
976bc|yyyyyyyyyyyyyyyyyy
977
978ab
979
980c|xxxx
981xxxxxx
982xxxxxxxx
983xxxxxxxxxx
984xxxxxxxxxxxx
985xxxxxxxxxxxxxx
986xxxxxxxxxxxxxxxx
987xxxxxxxxxxxxxxxxxx
988xxxxxxxxxxxxxxxxxxxx
989a
990bc|yyyyyyyyyyyyyyyy
991yyyyyyyyyyyyyy
992yyyyyyyyyyyy
993yyyyyyyyyy
994yyyyyyyy
995yyyyyy
996yyyy
997yy
998
999\pset format aligned
1000execute q;
1001-[ RECORD 1 ]-------------
1002 ab | xx
1003+   ;
1004+c  ;
1005 a  | yyyyyyyyyyyyyyyyyy
1006+bc ;
1007-[ RECORD 2 ]-------------
1008 ab | xxxx
1009+   : xxxxxx
1010+c  : xxxxxxxx
1011    : xxxxxxxxxx
1012    : xxxxxxxxxxxx
1013    : xxxxxxxxxxxxxx
1014    : xxxxxxxxxxxxxxxx
1015    : xxxxxxxxxxxxxxxxxx
1016    : xxxxxxxxxxxxxxxxxxxx
1017 a  | yyyyyyyyyyyyyyyy
1018+bc : yyyyyyyyyyyyyy
1019    : yyyyyyyyyyyy
1020    : yyyyyyyyyy
1021    : yyyyyyyy
1022    : yyyyyy
1023    : yyyy
1024    : yy
1025    :
1026
1027\pset format wrapped
1028execute q;
1029-[ RECORD 1 ]-------
1030 ab | xx
1031+   ;
1032+c  ;
1033 a  | yyyyyyyyyyyyyy
1034+bc ; yyyy
1035-[ RECORD 2 ]-------
1036 ab | xxxx
1037+   : xxxxxx
1038+c  : xxxxxxxx
1039    : xxxxxxxxxx
1040    : xxxxxxxxxxxx
1041    : xxxxxxxxxxxxxx
1042    : xxxxxxxxxxxxxx
1043    ; xx
1044    : xxxxxxxxxxxxxx
1045    ; xxxx
1046    : xxxxxxxxxxxxxx
1047    ; xxxxxx
1048 a  | yyyyyyyyyyyyyy
1049+bc ; yy
1050    : yyyyyyyyyyyyyy
1051    : yyyyyyyyyyyy
1052    : yyyyyyyyyy
1053    : yyyyyyyy
1054    : yyyyyy
1055    : yyyy
1056    : yy
1057    :
1058
1059\pset border 2
1060\pset format unaligned
1061execute q;
1062ab
1063
1064c|xx
1065a
1066bc|yyyyyyyyyyyyyyyyyy
1067
1068ab
1069
1070c|xxxx
1071xxxxxx
1072xxxxxxxx
1073xxxxxxxxxx
1074xxxxxxxxxxxx
1075xxxxxxxxxxxxxx
1076xxxxxxxxxxxxxxxx
1077xxxxxxxxxxxxxxxxxx
1078xxxxxxxxxxxxxxxxxxxx
1079a
1080bc|yyyyyyyyyyyyyyyy
1081yyyyyyyyyyyyyy
1082yyyyyyyyyyyy
1083yyyyyyyyyy
1084yyyyyyyy
1085yyyyyy
1086yyyy
1087yy
1088
1089\pset format aligned
1090execute q;
1091+-[ RECORD 1 ]--------------+
1092| ab | xx                   |
1093|+   ;                      |
1094|+c  ;                      |
1095| a  | yyyyyyyyyyyyyyyyyy   |
1096|+bc ;                      |
1097+-[ RECORD 2 ]--------------+
1098| ab | xxxx                 |
1099|+   : xxxxxx               |
1100|+c  : xxxxxxxx             |
1101|    : xxxxxxxxxx           |
1102|    : xxxxxxxxxxxx         |
1103|    : xxxxxxxxxxxxxx       |
1104|    : xxxxxxxxxxxxxxxx     |
1105|    : xxxxxxxxxxxxxxxxxx   |
1106|    : xxxxxxxxxxxxxxxxxxxx |
1107| a  | yyyyyyyyyyyyyyyy     |
1108|+bc : yyyyyyyyyyyyyy       |
1109|    : yyyyyyyyyyyy         |
1110|    : yyyyyyyyyy           |
1111|    : yyyyyyyy             |
1112|    : yyyyyy               |
1113|    : yyyy                 |
1114|    : yy                   |
1115|    :                      |
1116+----+----------------------+
1117
1118\pset format wrapped
1119execute q;
1120+-[ RECORD 1 ]-----+
1121| ab | xx          |
1122|+   ;             |
1123|+c  ;             |
1124| a  | yyyyyyyyyyy |
1125|+bc ; yyyyyyy     |
1126+-[ RECORD 2 ]-----+
1127| ab | xxxx        |
1128|+   : xxxxxx      |
1129|+c  : xxxxxxxx    |
1130|    : xxxxxxxxxx  |
1131|    : xxxxxxxxxxx |
1132|    ; x           |
1133|    : xxxxxxxxxxx |
1134|    ; xxx         |
1135|    : xxxxxxxxxxx |
1136|    ; xxxxx       |
1137|    : xxxxxxxxxxx |
1138|    ; xxxxxxx     |
1139|    : xxxxxxxxxxx |
1140|    ; xxxxxxxxx   |
1141| a  | yyyyyyyyyyy |
1142|+bc ; yyyyy       |
1143|    : yyyyyyyyyyy |
1144|    ; yyy         |
1145|    : yyyyyyyyyyy |
1146|    ; y           |
1147|    : yyyyyyyyyy  |
1148|    : yyyyyyyy    |
1149|    : yyyyyy      |
1150|    : yyyy        |
1151|    : yy          |
1152|    :             |
1153+----+-------------+
1154
1155deallocate q;
1156-- test single-line header and data
1157prepare q as select repeat('x',2*n) as "0123456789abcdef", repeat('y',20-2*n) as "0123456789" from generate_series(1,10) as n;
1158\pset linestyle ascii
1159\pset expanded off
1160\pset columns 40
1161\pset border 0
1162\pset format unaligned
1163execute q;
11640123456789abcdef|0123456789
1165xx|yyyyyyyyyyyyyyyyyy
1166xxxx|yyyyyyyyyyyyyyyy
1167xxxxxx|yyyyyyyyyyyyyy
1168xxxxxxxx|yyyyyyyyyyyy
1169xxxxxxxxxx|yyyyyyyyyy
1170xxxxxxxxxxxx|yyyyyyyy
1171xxxxxxxxxxxxxx|yyyyyy
1172xxxxxxxxxxxxxxxx|yyyy
1173xxxxxxxxxxxxxxxxxx|yy
1174xxxxxxxxxxxxxxxxxxxx|
1175(10 rows)
1176\pset format aligned
1177execute q;
1178  0123456789abcdef       0123456789
1179-------------------- ------------------
1180xx                   yyyyyyyyyyyyyyyyyy
1181xxxx                 yyyyyyyyyyyyyyyy
1182xxxxxx               yyyyyyyyyyyyyy
1183xxxxxxxx             yyyyyyyyyyyy
1184xxxxxxxxxx           yyyyyyyyyy
1185xxxxxxxxxxxx         yyyyyyyy
1186xxxxxxxxxxxxxx       yyyyyy
1187xxxxxxxxxxxxxxxx     yyyy
1188xxxxxxxxxxxxxxxxxx   yy
1189xxxxxxxxxxxxxxxxxxxx
1190(10 rows)
1191
1192\pset format wrapped
1193execute q;
1194  0123456789abcdef       0123456789
1195-------------------- ------------------
1196xx                   yyyyyyyyyyyyyyyyyy
1197xxxx                 yyyyyyyyyyyyyyyy
1198xxxxxx               yyyyyyyyyyyyyy
1199xxxxxxxx             yyyyyyyyyyyy
1200xxxxxxxxxx           yyyyyyyyyy
1201xxxxxxxxxxxx         yyyyyyyy
1202xxxxxxxxxxxxxx       yyyyyy
1203xxxxxxxxxxxxxxxx     yyyy
1204xxxxxxxxxxxxxxxxxx   yy
1205xxxxxxxxxxxxxxxxxxxx
1206(10 rows)
1207
1208\pset border 1
1209\pset format unaligned
1210execute q;
12110123456789abcdef|0123456789
1212xx|yyyyyyyyyyyyyyyyyy
1213xxxx|yyyyyyyyyyyyyyyy
1214xxxxxx|yyyyyyyyyyyyyy
1215xxxxxxxx|yyyyyyyyyyyy
1216xxxxxxxxxx|yyyyyyyyyy
1217xxxxxxxxxxxx|yyyyyyyy
1218xxxxxxxxxxxxxx|yyyyyy
1219xxxxxxxxxxxxxxxx|yyyy
1220xxxxxxxxxxxxxxxxxx|yy
1221xxxxxxxxxxxxxxxxxxxx|
1222(10 rows)
1223\pset format aligned
1224execute q;
1225   0123456789abcdef   |     0123456789
1226----------------------+--------------------
1227 xx                   | yyyyyyyyyyyyyyyyyy
1228 xxxx                 | yyyyyyyyyyyyyyyy
1229 xxxxxx               | yyyyyyyyyyyyyy
1230 xxxxxxxx             | yyyyyyyyyyyy
1231 xxxxxxxxxx           | yyyyyyyyyy
1232 xxxxxxxxxxxx         | yyyyyyyy
1233 xxxxxxxxxxxxxx       | yyyyyy
1234 xxxxxxxxxxxxxxxx     | yyyy
1235 xxxxxxxxxxxxxxxxxx   | yy
1236 xxxxxxxxxxxxxxxxxxxx |
1237(10 rows)
1238
1239\pset format wrapped
1240execute q;
1241  0123456789abcdef   |    0123456789
1242---------------------+------------------
1243 xx                  | yyyyyyyyyyyyyyyy.
1244                     |.yy
1245 xxxx                | yyyyyyyyyyyyyyyy
1246 xxxxxx              | yyyyyyyyyyyyyy
1247 xxxxxxxx            | yyyyyyyyyyyy
1248 xxxxxxxxxx          | yyyyyyyyyy
1249 xxxxxxxxxxxx        | yyyyyyyy
1250 xxxxxxxxxxxxxx      | yyyyyy
1251 xxxxxxxxxxxxxxxx    | yyyy
1252 xxxxxxxxxxxxxxxxxx  | yy
1253 xxxxxxxxxxxxxxxxxxx.|
1254.x                   |
1255(10 rows)
1256
1257\pset border 2
1258\pset format unaligned
1259execute q;
12600123456789abcdef|0123456789
1261xx|yyyyyyyyyyyyyyyyyy
1262xxxx|yyyyyyyyyyyyyyyy
1263xxxxxx|yyyyyyyyyyyyyy
1264xxxxxxxx|yyyyyyyyyyyy
1265xxxxxxxxxx|yyyyyyyyyy
1266xxxxxxxxxxxx|yyyyyyyy
1267xxxxxxxxxxxxxx|yyyyyy
1268xxxxxxxxxxxxxxxx|yyyy
1269xxxxxxxxxxxxxxxxxx|yy
1270xxxxxxxxxxxxxxxxxxxx|
1271(10 rows)
1272\pset format aligned
1273execute q;
1274+----------------------+--------------------+
1275|   0123456789abcdef   |     0123456789     |
1276+----------------------+--------------------+
1277| xx                   | yyyyyyyyyyyyyyyyyy |
1278| xxxx                 | yyyyyyyyyyyyyyyy   |
1279| xxxxxx               | yyyyyyyyyyyyyy     |
1280| xxxxxxxx             | yyyyyyyyyyyy       |
1281| xxxxxxxxxx           | yyyyyyyyyy         |
1282| xxxxxxxxxxxx         | yyyyyyyy           |
1283| xxxxxxxxxxxxxx       | yyyyyy             |
1284| xxxxxxxxxxxxxxxx     | yyyy               |
1285| xxxxxxxxxxxxxxxxxx   | yy                 |
1286| xxxxxxxxxxxxxxxxxxxx |                    |
1287+----------------------+--------------------+
1288(10 rows)
1289
1290\pset format wrapped
1291execute q;
1292+--------------------+-----------------+
1293|  0123456789abcdef  |   0123456789    |
1294+--------------------+-----------------+
1295| xx                 | yyyyyyyyyyyyyyy.|
1296|                    |.yyy             |
1297| xxxx               | yyyyyyyyyyyyyyy.|
1298|                    |.y               |
1299| xxxxxx             | yyyyyyyyyyyyyy  |
1300| xxxxxxxx           | yyyyyyyyyyyy    |
1301| xxxxxxxxxx         | yyyyyyyyyy      |
1302| xxxxxxxxxxxx       | yyyyyyyy        |
1303| xxxxxxxxxxxxxx     | yyyyyy          |
1304| xxxxxxxxxxxxxxxx   | yyyy            |
1305| xxxxxxxxxxxxxxxxxx | yy              |
1306| xxxxxxxxxxxxxxxxxx.|                 |
1307|.xx                 |                 |
1308+--------------------+-----------------+
1309(10 rows)
1310
1311\pset expanded on
1312\pset columns 30
1313\pset border 0
1314\pset format unaligned
1315execute q;
13160123456789abcdef|xx
13170123456789|yyyyyyyyyyyyyyyyyy
1318
13190123456789abcdef|xxxx
13200123456789|yyyyyyyyyyyyyyyy
1321
13220123456789abcdef|xxxxxx
13230123456789|yyyyyyyyyyyyyy
1324
13250123456789abcdef|xxxxxxxx
13260123456789|yyyyyyyyyyyy
1327
13280123456789abcdef|xxxxxxxxxx
13290123456789|yyyyyyyyyy
1330
13310123456789abcdef|xxxxxxxxxxxx
13320123456789|yyyyyyyy
1333
13340123456789abcdef|xxxxxxxxxxxxxx
13350123456789|yyyyyy
1336
13370123456789abcdef|xxxxxxxxxxxxxxxx
13380123456789|yyyy
1339
13400123456789abcdef|xxxxxxxxxxxxxxxxxx
13410123456789|yy
1342
13430123456789abcdef|xxxxxxxxxxxxxxxxxxxx
13440123456789|
1345\pset format aligned
1346execute q;
1347* Record 1
13480123456789abcdef xx
13490123456789       yyyyyyyyyyyyyyyyyy
1350* Record 2
13510123456789abcdef xxxx
13520123456789       yyyyyyyyyyyyyyyy
1353* Record 3
13540123456789abcdef xxxxxx
13550123456789       yyyyyyyyyyyyyy
1356* Record 4
13570123456789abcdef xxxxxxxx
13580123456789       yyyyyyyyyyyy
1359* Record 5
13600123456789abcdef xxxxxxxxxx
13610123456789       yyyyyyyyyy
1362* Record 6
13630123456789abcdef xxxxxxxxxxxx
13640123456789       yyyyyyyy
1365* Record 7
13660123456789abcdef xxxxxxxxxxxxxx
13670123456789       yyyyyy
1368* Record 8
13690123456789abcdef xxxxxxxxxxxxxxxx
13700123456789       yyyy
1371* Record 9
13720123456789abcdef xxxxxxxxxxxxxxxxxx
13730123456789       yy
1374* Record 10
13750123456789abcdef xxxxxxxxxxxxxxxxxxxx
13760123456789
1377
1378\pset format wrapped
1379execute q;
1380* Record 1
13810123456789abcdef xx
13820123456789       yyyyyyyyyyyy.
1383                .yyyyyy
1384* Record 2
13850123456789abcdef xxxx
13860123456789       yyyyyyyyyyyy.
1387                .yyyy
1388* Record 3
13890123456789abcdef xxxxxx
13900123456789       yyyyyyyyyyyy.
1391                .yy
1392* Record 4
13930123456789abcdef xxxxxxxx
13940123456789       yyyyyyyyyyyy
1395* Record 5
13960123456789abcdef xxxxxxxxxx
13970123456789       yyyyyyyyyy
1398* Record 6
13990123456789abcdef xxxxxxxxxxxx
14000123456789       yyyyyyyy
1401* Record 7
14020123456789abcdef xxxxxxxxxxxx.
1403                .xx
14040123456789       yyyyyy
1405* Record 8
14060123456789abcdef xxxxxxxxxxxx.
1407                .xxxx
14080123456789       yyyy
1409* Record 9
14100123456789abcdef xxxxxxxxxxxx.
1411                .xxxxxx
14120123456789       yy
1413* Record 10
14140123456789abcdef xxxxxxxxxxxx.
1415                .xxxxxxxx
14160123456789
1417
1418\pset border 1
1419\pset format unaligned
1420execute q;
14210123456789abcdef|xx
14220123456789|yyyyyyyyyyyyyyyyyy
1423
14240123456789abcdef|xxxx
14250123456789|yyyyyyyyyyyyyyyy
1426
14270123456789abcdef|xxxxxx
14280123456789|yyyyyyyyyyyyyy
1429
14300123456789abcdef|xxxxxxxx
14310123456789|yyyyyyyyyyyy
1432
14330123456789abcdef|xxxxxxxxxx
14340123456789|yyyyyyyyyy
1435
14360123456789abcdef|xxxxxxxxxxxx
14370123456789|yyyyyyyy
1438
14390123456789abcdef|xxxxxxxxxxxxxx
14400123456789|yyyyyy
1441
14420123456789abcdef|xxxxxxxxxxxxxxxx
14430123456789|yyyy
1444
14450123456789abcdef|xxxxxxxxxxxxxxxxxx
14460123456789|yy
1447
14480123456789abcdef|xxxxxxxxxxxxxxxxxxxx
14490123456789|
1450\pset format aligned
1451execute q;
1452-[ RECORD 1 ]----+---------------------
14530123456789abcdef | xx
14540123456789       | yyyyyyyyyyyyyyyyyy
1455-[ RECORD 2 ]----+---------------------
14560123456789abcdef | xxxx
14570123456789       | yyyyyyyyyyyyyyyy
1458-[ RECORD 3 ]----+---------------------
14590123456789abcdef | xxxxxx
14600123456789       | yyyyyyyyyyyyyy
1461-[ RECORD 4 ]----+---------------------
14620123456789abcdef | xxxxxxxx
14630123456789       | yyyyyyyyyyyy
1464-[ RECORD 5 ]----+---------------------
14650123456789abcdef | xxxxxxxxxx
14660123456789       | yyyyyyyyyy
1467-[ RECORD 6 ]----+---------------------
14680123456789abcdef | xxxxxxxxxxxx
14690123456789       | yyyyyyyy
1470-[ RECORD 7 ]----+---------------------
14710123456789abcdef | xxxxxxxxxxxxxx
14720123456789       | yyyyyy
1473-[ RECORD 8 ]----+---------------------
14740123456789abcdef | xxxxxxxxxxxxxxxx
14750123456789       | yyyy
1476-[ RECORD 9 ]----+---------------------
14770123456789abcdef | xxxxxxxxxxxxxxxxxx
14780123456789       | yy
1479-[ RECORD 10 ]---+---------------------
14800123456789abcdef | xxxxxxxxxxxxxxxxxxxx
14810123456789       |
1482
1483\pset format wrapped
1484execute q;
1485-[ RECORD 1 ]----+-----------
14860123456789abcdef | xx
14870123456789       | yyyyyyyyyy.
1488                 |.yyyyyyyy
1489-[ RECORD 2 ]----+-----------
14900123456789abcdef | xxxx
14910123456789       | yyyyyyyyyy.
1492                 |.yyyyyy
1493-[ RECORD 3 ]----+-----------
14940123456789abcdef | xxxxxx
14950123456789       | yyyyyyyyyy.
1496                 |.yyyy
1497-[ RECORD 4 ]----+-----------
14980123456789abcdef | xxxxxxxx
14990123456789       | yyyyyyyyyy.
1500                 |.yy
1501-[ RECORD 5 ]----+-----------
15020123456789abcdef | xxxxxxxxxx
15030123456789       | yyyyyyyyyy
1504-[ RECORD 6 ]----+-----------
15050123456789abcdef | xxxxxxxxxx.
1506                 |.xx
15070123456789       | yyyyyyyy
1508-[ RECORD 7 ]----+-----------
15090123456789abcdef | xxxxxxxxxx.
1510                 |.xxxx
15110123456789       | yyyyyy
1512-[ RECORD 8 ]----+-----------
15130123456789abcdef | xxxxxxxxxx.
1514                 |.xxxxxx
15150123456789       | yyyy
1516-[ RECORD 9 ]----+-----------
15170123456789abcdef | xxxxxxxxxx.
1518                 |.xxxxxxxx
15190123456789       | yy
1520-[ RECORD 10 ]---+-----------
15210123456789abcdef | xxxxxxxxxx.
1522                 |.xxxxxxxxxx
15230123456789       |
1524
1525\pset border 2
1526\pset format unaligned
1527execute q;
15280123456789abcdef|xx
15290123456789|yyyyyyyyyyyyyyyyyy
1530
15310123456789abcdef|xxxx
15320123456789|yyyyyyyyyyyyyyyy
1533
15340123456789abcdef|xxxxxx
15350123456789|yyyyyyyyyyyyyy
1536
15370123456789abcdef|xxxxxxxx
15380123456789|yyyyyyyyyyyy
1539
15400123456789abcdef|xxxxxxxxxx
15410123456789|yyyyyyyyyy
1542
15430123456789abcdef|xxxxxxxxxxxx
15440123456789|yyyyyyyy
1545
15460123456789abcdef|xxxxxxxxxxxxxx
15470123456789|yyyyyy
1548
15490123456789abcdef|xxxxxxxxxxxxxxxx
15500123456789|yyyy
1551
15520123456789abcdef|xxxxxxxxxxxxxxxxxx
15530123456789|yy
1554
15550123456789abcdef|xxxxxxxxxxxxxxxxxxxx
15560123456789|
1557\pset format aligned
1558execute q;
1559+-[ RECORD 1 ]-----+----------------------+
1560| 0123456789abcdef | xx                   |
1561| 0123456789       | yyyyyyyyyyyyyyyyyy   |
1562+-[ RECORD 2 ]-----+----------------------+
1563| 0123456789abcdef | xxxx                 |
1564| 0123456789       | yyyyyyyyyyyyyyyy     |
1565+-[ RECORD 3 ]-----+----------------------+
1566| 0123456789abcdef | xxxxxx               |
1567| 0123456789       | yyyyyyyyyyyyyy       |
1568+-[ RECORD 4 ]-----+----------------------+
1569| 0123456789abcdef | xxxxxxxx             |
1570| 0123456789       | yyyyyyyyyyyy         |
1571+-[ RECORD 5 ]-----+----------------------+
1572| 0123456789abcdef | xxxxxxxxxx           |
1573| 0123456789       | yyyyyyyyyy           |
1574+-[ RECORD 6 ]-----+----------------------+
1575| 0123456789abcdef | xxxxxxxxxxxx         |
1576| 0123456789       | yyyyyyyy             |
1577+-[ RECORD 7 ]-----+----------------------+
1578| 0123456789abcdef | xxxxxxxxxxxxxx       |
1579| 0123456789       | yyyyyy               |
1580+-[ RECORD 8 ]-----+----------------------+
1581| 0123456789abcdef | xxxxxxxxxxxxxxxx     |
1582| 0123456789       | yyyy                 |
1583+-[ RECORD 9 ]-----+----------------------+
1584| 0123456789abcdef | xxxxxxxxxxxxxxxxxx   |
1585| 0123456789       | yy                   |
1586+-[ RECORD 10 ]----+----------------------+
1587| 0123456789abcdef | xxxxxxxxxxxxxxxxxxxx |
1588| 0123456789       |                      |
1589+------------------+----------------------+
1590
1591\pset format wrapped
1592execute q;
1593+-[ RECORD 1 ]-----+---------+
1594| 0123456789abcdef | xx      |
1595| 0123456789       | yyyyyyy.|
1596|                  |.yyyyyyy.|
1597|                  |.yyyy    |
1598+-[ RECORD 2 ]-----+---------+
1599| 0123456789abcdef | xxxx    |
1600| 0123456789       | yyyyyyy.|
1601|                  |.yyyyyyy.|
1602|                  |.yy      |
1603+-[ RECORD 3 ]-----+---------+
1604| 0123456789abcdef | xxxxxx  |
1605| 0123456789       | yyyyyyy.|
1606|                  |.yyyyyyy |
1607+-[ RECORD 4 ]-----+---------+
1608| 0123456789abcdef | xxxxxxx.|
1609|                  |.x       |
1610| 0123456789       | yyyyyyy.|
1611|                  |.yyyyy   |
1612+-[ RECORD 5 ]-----+---------+
1613| 0123456789abcdef | xxxxxxx.|
1614|                  |.xxx     |
1615| 0123456789       | yyyyyyy.|
1616|                  |.yyy     |
1617+-[ RECORD 6 ]-----+---------+
1618| 0123456789abcdef | xxxxxxx.|
1619|                  |.xxxxx   |
1620| 0123456789       | yyyyyyy.|
1621|                  |.y       |
1622+-[ RECORD 7 ]-----+---------+
1623| 0123456789abcdef | xxxxxxx.|
1624|                  |.xxxxxxx |
1625| 0123456789       | yyyyyy  |
1626+-[ RECORD 8 ]-----+---------+
1627| 0123456789abcdef | xxxxxxx.|
1628|                  |.xxxxxxx.|
1629|                  |.xx      |
1630| 0123456789       | yyyy    |
1631+-[ RECORD 9 ]-----+---------+
1632| 0123456789abcdef | xxxxxxx.|
1633|                  |.xxxxxxx.|
1634|                  |.xxxx    |
1635| 0123456789       | yy      |
1636+-[ RECORD 10 ]----+---------+
1637| 0123456789abcdef | xxxxxxx.|
1638|                  |.xxxxxxx.|
1639|                  |.xxxxxx  |
1640| 0123456789       |         |
1641+------------------+---------+
1642
1643\pset expanded on
1644\pset columns 20
1645\pset border 0
1646\pset format unaligned
1647execute q;
16480123456789abcdef|xx
16490123456789|yyyyyyyyyyyyyyyyyy
1650
16510123456789abcdef|xxxx
16520123456789|yyyyyyyyyyyyyyyy
1653
16540123456789abcdef|xxxxxx
16550123456789|yyyyyyyyyyyyyy
1656
16570123456789abcdef|xxxxxxxx
16580123456789|yyyyyyyyyyyy
1659
16600123456789abcdef|xxxxxxxxxx
16610123456789|yyyyyyyyyy
1662
16630123456789abcdef|xxxxxxxxxxxx
16640123456789|yyyyyyyy
1665
16660123456789abcdef|xxxxxxxxxxxxxx
16670123456789|yyyyyy
1668
16690123456789abcdef|xxxxxxxxxxxxxxxx
16700123456789|yyyy
1671
16720123456789abcdef|xxxxxxxxxxxxxxxxxx
16730123456789|yy
1674
16750123456789abcdef|xxxxxxxxxxxxxxxxxxxx
16760123456789|
1677\pset format aligned
1678execute q;
1679* Record 1
16800123456789abcdef xx
16810123456789       yyyyyyyyyyyyyyyyyy
1682* Record 2
16830123456789abcdef xxxx
16840123456789       yyyyyyyyyyyyyyyy
1685* Record 3
16860123456789abcdef xxxxxx
16870123456789       yyyyyyyyyyyyyy
1688* Record 4
16890123456789abcdef xxxxxxxx
16900123456789       yyyyyyyyyyyy
1691* Record 5
16920123456789abcdef xxxxxxxxxx
16930123456789       yyyyyyyyyy
1694* Record 6
16950123456789abcdef xxxxxxxxxxxx
16960123456789       yyyyyyyy
1697* Record 7
16980123456789abcdef xxxxxxxxxxxxxx
16990123456789       yyyyyy
1700* Record 8
17010123456789abcdef xxxxxxxxxxxxxxxx
17020123456789       yyyy
1703* Record 9
17040123456789abcdef xxxxxxxxxxxxxxxxxx
17050123456789       yy
1706* Record 10
17070123456789abcdef xxxxxxxxxxxxxxxxxxxx
17080123456789
1709
1710\pset format wrapped
1711execute q;
1712* Record 1
17130123456789abcdef xx
17140123456789       yyy.
1715                .yyy.
1716                .yyy.
1717                .yyy.
1718                .yyy.
1719                .yyy
1720* Record 2
17210123456789abcdef xxx.
1722                .x
17230123456789       yyy.
1724                .yyy.
1725                .yyy.
1726                .yyy.
1727                .yyy.
1728                .y
1729* Record 3
17300123456789abcdef xxx.
1731                .xxx
17320123456789       yyy.
1733                .yyy.
1734                .yyy.
1735                .yyy.
1736                .yy
1737* Record 4
17380123456789abcdef xxx.
1739                .xxx.
1740                .xx
17410123456789       yyy.
1742                .yyy.
1743                .yyy.
1744                .yyy
1745* Record 5
17460123456789abcdef xxx.
1747                .xxx.
1748                .xxx.
1749                .x
17500123456789       yyy.
1751                .yyy.
1752                .yyy.
1753                .y
1754* Record 6
17550123456789abcdef xxx.
1756                .xxx.
1757                .xxx.
1758                .xxx
17590123456789       yyy.
1760                .yyy.
1761                .yy
1762* Record 7
17630123456789abcdef xxx.
1764                .xxx.
1765                .xxx.
1766                .xxx.
1767                .xx
17680123456789       yyy.
1769                .yyy
1770* Record 8
17710123456789abcdef xxx.
1772                .xxx.
1773                .xxx.
1774                .xxx.
1775                .xxx.
1776                .x
17770123456789       yyy.
1778                .y
1779* Record 9
17800123456789abcdef xxx.
1781                .xxx.
1782                .xxx.
1783                .xxx.
1784                .xxx.
1785                .xxx
17860123456789       yy
1787* Record 10
17880123456789abcdef xxx.
1789                .xxx.
1790                .xxx.
1791                .xxx.
1792                .xxx.
1793                .xxx.
1794                .xx
17950123456789
1796
1797\pset border 1
1798\pset format unaligned
1799execute q;
18000123456789abcdef|xx
18010123456789|yyyyyyyyyyyyyyyyyy
1802
18030123456789abcdef|xxxx
18040123456789|yyyyyyyyyyyyyyyy
1805
18060123456789abcdef|xxxxxx
18070123456789|yyyyyyyyyyyyyy
1808
18090123456789abcdef|xxxxxxxx
18100123456789|yyyyyyyyyyyy
1811
18120123456789abcdef|xxxxxxxxxx
18130123456789|yyyyyyyyyy
1814
18150123456789abcdef|xxxxxxxxxxxx
18160123456789|yyyyyyyy
1817
18180123456789abcdef|xxxxxxxxxxxxxx
18190123456789|yyyyyy
1820
18210123456789abcdef|xxxxxxxxxxxxxxxx
18220123456789|yyyy
1823
18240123456789abcdef|xxxxxxxxxxxxxxxxxx
18250123456789|yy
1826
18270123456789abcdef|xxxxxxxxxxxxxxxxxxxx
18280123456789|
1829\pset format aligned
1830execute q;
1831-[ RECORD 1 ]----+---------------------
18320123456789abcdef | xx
18330123456789       | yyyyyyyyyyyyyyyyyy
1834-[ RECORD 2 ]----+---------------------
18350123456789abcdef | xxxx
18360123456789       | yyyyyyyyyyyyyyyy
1837-[ RECORD 3 ]----+---------------------
18380123456789abcdef | xxxxxx
18390123456789       | yyyyyyyyyyyyyy
1840-[ RECORD 4 ]----+---------------------
18410123456789abcdef | xxxxxxxx
18420123456789       | yyyyyyyyyyyy
1843-[ RECORD 5 ]----+---------------------
18440123456789abcdef | xxxxxxxxxx
18450123456789       | yyyyyyyyyy
1846-[ RECORD 6 ]----+---------------------
18470123456789abcdef | xxxxxxxxxxxx
18480123456789       | yyyyyyyy
1849-[ RECORD 7 ]----+---------------------
18500123456789abcdef | xxxxxxxxxxxxxx
18510123456789       | yyyyyy
1852-[ RECORD 8 ]----+---------------------
18530123456789abcdef | xxxxxxxxxxxxxxxx
18540123456789       | yyyy
1855-[ RECORD 9 ]----+---------------------
18560123456789abcdef | xxxxxxxxxxxxxxxxxx
18570123456789       | yy
1858-[ RECORD 10 ]---+---------------------
18590123456789abcdef | xxxxxxxxxxxxxxxxxxxx
18600123456789       |
1861
1862\pset format wrapped
1863execute q;
1864-[ RECORD 1 ]----+----
18650123456789abcdef | xx
18660123456789       | yyy.
1867                 |.yyy.
1868                 |.yyy.
1869                 |.yyy.
1870                 |.yyy.
1871                 |.yyy
1872-[ RECORD 2 ]----+----
18730123456789abcdef | xxx.
1874                 |.x
18750123456789       | yyy.
1876                 |.yyy.
1877                 |.yyy.
1878                 |.yyy.
1879                 |.yyy.
1880                 |.y
1881-[ RECORD 3 ]----+----
18820123456789abcdef | xxx.
1883                 |.xxx
18840123456789       | yyy.
1885                 |.yyy.
1886                 |.yyy.
1887                 |.yyy.
1888                 |.yy
1889-[ RECORD 4 ]----+----
18900123456789abcdef | xxx.
1891                 |.xxx.
1892                 |.xx
18930123456789       | yyy.
1894                 |.yyy.
1895                 |.yyy.
1896                 |.yyy
1897-[ RECORD 5 ]----+----
18980123456789abcdef | xxx.
1899                 |.xxx.
1900                 |.xxx.
1901                 |.x
19020123456789       | yyy.
1903                 |.yyy.
1904                 |.yyy.
1905                 |.y
1906-[ RECORD 6 ]----+----
19070123456789abcdef | xxx.
1908                 |.xxx.
1909                 |.xxx.
1910                 |.xxx
19110123456789       | yyy.
1912                 |.yyy.
1913                 |.yy
1914-[ RECORD 7 ]----+----
19150123456789abcdef | xxx.
1916                 |.xxx.
1917                 |.xxx.
1918                 |.xxx.
1919                 |.xx
19200123456789       | yyy.
1921                 |.yyy
1922-[ RECORD 8 ]----+----
19230123456789abcdef | xxx.
1924                 |.xxx.
1925                 |.xxx.
1926                 |.xxx.
1927                 |.xxx.
1928                 |.x
19290123456789       | yyy.
1930                 |.y
1931-[ RECORD 9 ]----+----
19320123456789abcdef | xxx.
1933                 |.xxx.
1934                 |.xxx.
1935                 |.xxx.
1936                 |.xxx.
1937                 |.xxx
19380123456789       | yy
1939-[ RECORD 10 ]---+----
19400123456789abcdef | xxx.
1941                 |.xxx.
1942                 |.xxx.
1943                 |.xxx.
1944                 |.xxx.
1945                 |.xxx.
1946                 |.xx
19470123456789       |
1948
1949\pset border 2
1950\pset format unaligned
1951execute q;
19520123456789abcdef|xx
19530123456789|yyyyyyyyyyyyyyyyyy
1954
19550123456789abcdef|xxxx
19560123456789|yyyyyyyyyyyyyyyy
1957
19580123456789abcdef|xxxxxx
19590123456789|yyyyyyyyyyyyyy
1960
19610123456789abcdef|xxxxxxxx
19620123456789|yyyyyyyyyyyy
1963
19640123456789abcdef|xxxxxxxxxx
19650123456789|yyyyyyyyyy
1966
19670123456789abcdef|xxxxxxxxxxxx
19680123456789|yyyyyyyy
1969
19700123456789abcdef|xxxxxxxxxxxxxx
19710123456789|yyyyyy
1972
19730123456789abcdef|xxxxxxxxxxxxxxxx
19740123456789|yyyy
1975
19760123456789abcdef|xxxxxxxxxxxxxxxxxx
19770123456789|yy
1978
19790123456789abcdef|xxxxxxxxxxxxxxxxxxxx
19800123456789|
1981\pset format aligned
1982execute q;
1983+-[ RECORD 1 ]-----+----------------------+
1984| 0123456789abcdef | xx                   |
1985| 0123456789       | yyyyyyyyyyyyyyyyyy   |
1986+-[ RECORD 2 ]-----+----------------------+
1987| 0123456789abcdef | xxxx                 |
1988| 0123456789       | yyyyyyyyyyyyyyyy     |
1989+-[ RECORD 3 ]-----+----------------------+
1990| 0123456789abcdef | xxxxxx               |
1991| 0123456789       | yyyyyyyyyyyyyy       |
1992+-[ RECORD 4 ]-----+----------------------+
1993| 0123456789abcdef | xxxxxxxx             |
1994| 0123456789       | yyyyyyyyyyyy         |
1995+-[ RECORD 5 ]-----+----------------------+
1996| 0123456789abcdef | xxxxxxxxxx           |
1997| 0123456789       | yyyyyyyyyy           |
1998+-[ RECORD 6 ]-----+----------------------+
1999| 0123456789abcdef | xxxxxxxxxxxx         |
2000| 0123456789       | yyyyyyyy             |
2001+-[ RECORD 7 ]-----+----------------------+
2002| 0123456789abcdef | xxxxxxxxxxxxxx       |
2003| 0123456789       | yyyyyy               |
2004+-[ RECORD 8 ]-----+----------------------+
2005| 0123456789abcdef | xxxxxxxxxxxxxxxx     |
2006| 0123456789       | yyyy                 |
2007+-[ RECORD 9 ]-----+----------------------+
2008| 0123456789abcdef | xxxxxxxxxxxxxxxxxx   |
2009| 0123456789       | yy                   |
2010+-[ RECORD 10 ]----+----------------------+
2011| 0123456789abcdef | xxxxxxxxxxxxxxxxxxxx |
2012| 0123456789       |                      |
2013+------------------+----------------------+
2014
2015\pset format wrapped
2016execute q;
2017+-[ RECORD 1 ]-----+-----+
2018| 0123456789abcdef | xx  |
2019| 0123456789       | yyy.|
2020|                  |.yyy.|
2021|                  |.yyy.|
2022|                  |.yyy.|
2023|                  |.yyy.|
2024|                  |.yyy |
2025+-[ RECORD 2 ]-----+-----+
2026| 0123456789abcdef | xxx.|
2027|                  |.x   |
2028| 0123456789       | yyy.|
2029|                  |.yyy.|
2030|                  |.yyy.|
2031|                  |.yyy.|
2032|                  |.yyy.|
2033|                  |.y   |
2034+-[ RECORD 3 ]-----+-----+
2035| 0123456789abcdef | xxx.|
2036|                  |.xxx |
2037| 0123456789       | yyy.|
2038|                  |.yyy.|
2039|                  |.yyy.|
2040|                  |.yyy.|
2041|                  |.yy  |
2042+-[ RECORD 4 ]-----+-----+
2043| 0123456789abcdef | xxx.|
2044|                  |.xxx.|
2045|                  |.xx  |
2046| 0123456789       | yyy.|
2047|                  |.yyy.|
2048|                  |.yyy.|
2049|                  |.yyy |
2050+-[ RECORD 5 ]-----+-----+
2051| 0123456789abcdef | xxx.|
2052|                  |.xxx.|
2053|                  |.xxx.|
2054|                  |.x   |
2055| 0123456789       | yyy.|
2056|                  |.yyy.|
2057|                  |.yyy.|
2058|                  |.y   |
2059+-[ RECORD 6 ]-----+-----+
2060| 0123456789abcdef | xxx.|
2061|                  |.xxx.|
2062|                  |.xxx.|
2063|                  |.xxx |
2064| 0123456789       | yyy.|
2065|                  |.yyy.|
2066|                  |.yy  |
2067+-[ RECORD 7 ]-----+-----+
2068| 0123456789abcdef | xxx.|
2069|                  |.xxx.|
2070|                  |.xxx.|
2071|                  |.xxx.|
2072|                  |.xx  |
2073| 0123456789       | yyy.|
2074|                  |.yyy |
2075+-[ RECORD 8 ]-----+-----+
2076| 0123456789abcdef | xxx.|
2077|                  |.xxx.|
2078|                  |.xxx.|
2079|                  |.xxx.|
2080|                  |.xxx.|
2081|                  |.x   |
2082| 0123456789       | yyy.|
2083|                  |.y   |
2084+-[ RECORD 9 ]-----+-----+
2085| 0123456789abcdef | xxx.|
2086|                  |.xxx.|
2087|                  |.xxx.|
2088|                  |.xxx.|
2089|                  |.xxx.|
2090|                  |.xxx |
2091| 0123456789       | yy  |
2092+-[ RECORD 10 ]----+-----+
2093| 0123456789abcdef | xxx.|
2094|                  |.xxx.|
2095|                  |.xxx.|
2096|                  |.xxx.|
2097|                  |.xxx.|
2098|                  |.xxx.|
2099|                  |.xx  |
2100| 0123456789       |     |
2101+------------------+-----+
2102
2103\pset linestyle old-ascii
2104\pset expanded off
2105\pset columns 40
2106\pset border 0
2107\pset format unaligned
2108execute q;
21090123456789abcdef|0123456789
2110xx|yyyyyyyyyyyyyyyyyy
2111xxxx|yyyyyyyyyyyyyyyy
2112xxxxxx|yyyyyyyyyyyyyy
2113xxxxxxxx|yyyyyyyyyyyy
2114xxxxxxxxxx|yyyyyyyyyy
2115xxxxxxxxxxxx|yyyyyyyy
2116xxxxxxxxxxxxxx|yyyyyy
2117xxxxxxxxxxxxxxxx|yyyy
2118xxxxxxxxxxxxxxxxxx|yy
2119xxxxxxxxxxxxxxxxxxxx|
2120(10 rows)
2121\pset format aligned
2122execute q;
2123  0123456789abcdef       0123456789
2124-------------------- ------------------
2125xx                   yyyyyyyyyyyyyyyyyy
2126xxxx                 yyyyyyyyyyyyyyyy
2127xxxxxx               yyyyyyyyyyyyyy
2128xxxxxxxx             yyyyyyyyyyyy
2129xxxxxxxxxx           yyyyyyyyyy
2130xxxxxxxxxxxx         yyyyyyyy
2131xxxxxxxxxxxxxx       yyyyyy
2132xxxxxxxxxxxxxxxx     yyyy
2133xxxxxxxxxxxxxxxxxx   yy
2134xxxxxxxxxxxxxxxxxxxx
2135(10 rows)
2136
2137\pset format wrapped
2138execute q;
2139  0123456789abcdef       0123456789
2140-------------------- ------------------
2141xx                   yyyyyyyyyyyyyyyyyy
2142xxxx                 yyyyyyyyyyyyyyyy
2143xxxxxx               yyyyyyyyyyyyyy
2144xxxxxxxx             yyyyyyyyyyyy
2145xxxxxxxxxx           yyyyyyyyyy
2146xxxxxxxxxxxx         yyyyyyyy
2147xxxxxxxxxxxxxx       yyyyyy
2148xxxxxxxxxxxxxxxx     yyyy
2149xxxxxxxxxxxxxxxxxx   yy
2150xxxxxxxxxxxxxxxxxxxx
2151(10 rows)
2152
2153\pset border 1
2154\pset format unaligned
2155execute q;
21560123456789abcdef|0123456789
2157xx|yyyyyyyyyyyyyyyyyy
2158xxxx|yyyyyyyyyyyyyyyy
2159xxxxxx|yyyyyyyyyyyyyy
2160xxxxxxxx|yyyyyyyyyyyy
2161xxxxxxxxxx|yyyyyyyyyy
2162xxxxxxxxxxxx|yyyyyyyy
2163xxxxxxxxxxxxxx|yyyyyy
2164xxxxxxxxxxxxxxxx|yyyy
2165xxxxxxxxxxxxxxxxxx|yy
2166xxxxxxxxxxxxxxxxxxxx|
2167(10 rows)
2168\pset format aligned
2169execute q;
2170   0123456789abcdef   |     0123456789
2171----------------------+--------------------
2172 xx                   | yyyyyyyyyyyyyyyyyy
2173 xxxx                 | yyyyyyyyyyyyyyyy
2174 xxxxxx               | yyyyyyyyyyyyyy
2175 xxxxxxxx             | yyyyyyyyyyyy
2176 xxxxxxxxxx           | yyyyyyyyyy
2177 xxxxxxxxxxxx         | yyyyyyyy
2178 xxxxxxxxxxxxxx       | yyyyyy
2179 xxxxxxxxxxxxxxxx     | yyyy
2180 xxxxxxxxxxxxxxxxxx   | yy
2181 xxxxxxxxxxxxxxxxxxxx |
2182(10 rows)
2183
2184\pset format wrapped
2185execute q;
2186  0123456789abcdef   |    0123456789
2187---------------------+------------------
2188 xx                  | yyyyyyyyyyyyyyyy
2189                     ; yy
2190 xxxx                | yyyyyyyyyyyyyyyy
2191 xxxxxx              | yyyyyyyyyyyyyy
2192 xxxxxxxx            | yyyyyyyyyyyy
2193 xxxxxxxxxx          | yyyyyyyyyy
2194 xxxxxxxxxxxx        | yyyyyyyy
2195 xxxxxxxxxxxxxx      | yyyyyy
2196 xxxxxxxxxxxxxxxx    | yyyy
2197 xxxxxxxxxxxxxxxxxx  | yy
2198 xxxxxxxxxxxxxxxxxxx |
2199 x
2200(10 rows)
2201
2202\pset border 2
2203\pset format unaligned
2204execute q;
22050123456789abcdef|0123456789
2206xx|yyyyyyyyyyyyyyyyyy
2207xxxx|yyyyyyyyyyyyyyyy
2208xxxxxx|yyyyyyyyyyyyyy
2209xxxxxxxx|yyyyyyyyyyyy
2210xxxxxxxxxx|yyyyyyyyyy
2211xxxxxxxxxxxx|yyyyyyyy
2212xxxxxxxxxxxxxx|yyyyyy
2213xxxxxxxxxxxxxxxx|yyyy
2214xxxxxxxxxxxxxxxxxx|yy
2215xxxxxxxxxxxxxxxxxxxx|
2216(10 rows)
2217\pset format aligned
2218execute q;
2219+----------------------+--------------------+
2220|   0123456789abcdef   |     0123456789     |
2221+----------------------+--------------------+
2222| xx                   | yyyyyyyyyyyyyyyyyy |
2223| xxxx                 | yyyyyyyyyyyyyyyy   |
2224| xxxxxx               | yyyyyyyyyyyyyy     |
2225| xxxxxxxx             | yyyyyyyyyyyy       |
2226| xxxxxxxxxx           | yyyyyyyyyy         |
2227| xxxxxxxxxxxx         | yyyyyyyy           |
2228| xxxxxxxxxxxxxx       | yyyyyy             |
2229| xxxxxxxxxxxxxxxx     | yyyy               |
2230| xxxxxxxxxxxxxxxxxx   | yy                 |
2231| xxxxxxxxxxxxxxxxxxxx |                    |
2232+----------------------+--------------------+
2233(10 rows)
2234
2235\pset format wrapped
2236execute q;
2237+--------------------+-----------------+
2238|  0123456789abcdef  |   0123456789    |
2239+--------------------+-----------------+
2240| xx                 | yyyyyyyyyyyyyyy |
2241|                    ; yyy             |
2242| xxxx               | yyyyyyyyyyyyyyy |
2243|                    ; y               |
2244| xxxxxx             | yyyyyyyyyyyyyy  |
2245| xxxxxxxx           | yyyyyyyyyyyy    |
2246| xxxxxxxxxx         | yyyyyyyyyy      |
2247| xxxxxxxxxxxx       | yyyyyyyy        |
2248| xxxxxxxxxxxxxx     | yyyyyy          |
2249| xxxxxxxxxxxxxxxx   | yyyy            |
2250| xxxxxxxxxxxxxxxxxx | yy              |
2251| xxxxxxxxxxxxxxxxxx |                 |
2252| xx                                   |
2253+--------------------+-----------------+
2254(10 rows)
2255
2256\pset expanded on
2257\pset border 0
2258\pset format unaligned
2259execute q;
22600123456789abcdef|xx
22610123456789|yyyyyyyyyyyyyyyyyy
2262
22630123456789abcdef|xxxx
22640123456789|yyyyyyyyyyyyyyyy
2265
22660123456789abcdef|xxxxxx
22670123456789|yyyyyyyyyyyyyy
2268
22690123456789abcdef|xxxxxxxx
22700123456789|yyyyyyyyyyyy
2271
22720123456789abcdef|xxxxxxxxxx
22730123456789|yyyyyyyyyy
2274
22750123456789abcdef|xxxxxxxxxxxx
22760123456789|yyyyyyyy
2277
22780123456789abcdef|xxxxxxxxxxxxxx
22790123456789|yyyyyy
2280
22810123456789abcdef|xxxxxxxxxxxxxxxx
22820123456789|yyyy
2283
22840123456789abcdef|xxxxxxxxxxxxxxxxxx
22850123456789|yy
2286
22870123456789abcdef|xxxxxxxxxxxxxxxxxxxx
22880123456789|
2289\pset format aligned
2290execute q;
2291* Record 1
22920123456789abcdef xx
22930123456789       yyyyyyyyyyyyyyyyyy
2294* Record 2
22950123456789abcdef xxxx
22960123456789       yyyyyyyyyyyyyyyy
2297* Record 3
22980123456789abcdef xxxxxx
22990123456789       yyyyyyyyyyyyyy
2300* Record 4
23010123456789abcdef xxxxxxxx
23020123456789       yyyyyyyyyyyy
2303* Record 5
23040123456789abcdef xxxxxxxxxx
23050123456789       yyyyyyyyyy
2306* Record 6
23070123456789abcdef xxxxxxxxxxxx
23080123456789       yyyyyyyy
2309* Record 7
23100123456789abcdef xxxxxxxxxxxxxx
23110123456789       yyyyyy
2312* Record 8
23130123456789abcdef xxxxxxxxxxxxxxxx
23140123456789       yyyy
2315* Record 9
23160123456789abcdef xxxxxxxxxxxxxxxxxx
23170123456789       yy
2318* Record 10
23190123456789abcdef xxxxxxxxxxxxxxxxxxxx
23200123456789
2321
2322\pset format wrapped
2323execute q;
2324* Record 1
23250123456789abcdef xx
23260123456789       yyyyyyyyyyyyyyyyyy
2327* Record 2
23280123456789abcdef xxxx
23290123456789       yyyyyyyyyyyyyyyy
2330* Record 3
23310123456789abcdef xxxxxx
23320123456789       yyyyyyyyyyyyyy
2333* Record 4
23340123456789abcdef xxxxxxxx
23350123456789       yyyyyyyyyyyy
2336* Record 5
23370123456789abcdef xxxxxxxxxx
23380123456789       yyyyyyyyyy
2339* Record 6
23400123456789abcdef xxxxxxxxxxxx
23410123456789       yyyyyyyy
2342* Record 7
23430123456789abcdef xxxxxxxxxxxxxx
23440123456789       yyyyyy
2345* Record 8
23460123456789abcdef xxxxxxxxxxxxxxxx
23470123456789       yyyy
2348* Record 9
23490123456789abcdef xxxxxxxxxxxxxxxxxx
23500123456789       yy
2351* Record 10
23520123456789abcdef xxxxxxxxxxxxxxxxxxxx
23530123456789
2354
2355\pset border 1
2356\pset format unaligned
2357execute q;
23580123456789abcdef|xx
23590123456789|yyyyyyyyyyyyyyyyyy
2360
23610123456789abcdef|xxxx
23620123456789|yyyyyyyyyyyyyyyy
2363
23640123456789abcdef|xxxxxx
23650123456789|yyyyyyyyyyyyyy
2366
23670123456789abcdef|xxxxxxxx
23680123456789|yyyyyyyyyyyy
2369
23700123456789abcdef|xxxxxxxxxx
23710123456789|yyyyyyyyyy
2372
23730123456789abcdef|xxxxxxxxxxxx
23740123456789|yyyyyyyy
2375
23760123456789abcdef|xxxxxxxxxxxxxx
23770123456789|yyyyyy
2378
23790123456789abcdef|xxxxxxxxxxxxxxxx
23800123456789|yyyy
2381
23820123456789abcdef|xxxxxxxxxxxxxxxxxx
23830123456789|yy
2384
23850123456789abcdef|xxxxxxxxxxxxxxxxxxxx
23860123456789|
2387\pset format aligned
2388execute q;
2389-[ RECORD 1 ]----+---------------------
23900123456789abcdef | xx
23910123456789       | yyyyyyyyyyyyyyyyyy
2392-[ RECORD 2 ]----+---------------------
23930123456789abcdef | xxxx
23940123456789       | yyyyyyyyyyyyyyyy
2395-[ RECORD 3 ]----+---------------------
23960123456789abcdef | xxxxxx
23970123456789       | yyyyyyyyyyyyyy
2398-[ RECORD 4 ]----+---------------------
23990123456789abcdef | xxxxxxxx
24000123456789       | yyyyyyyyyyyy
2401-[ RECORD 5 ]----+---------------------
24020123456789abcdef | xxxxxxxxxx
24030123456789       | yyyyyyyyyy
2404-[ RECORD 6 ]----+---------------------
24050123456789abcdef | xxxxxxxxxxxx
24060123456789       | yyyyyyyy
2407-[ RECORD 7 ]----+---------------------
24080123456789abcdef | xxxxxxxxxxxxxx
24090123456789       | yyyyyy
2410-[ RECORD 8 ]----+---------------------
24110123456789abcdef | xxxxxxxxxxxxxxxx
24120123456789       | yyyy
2413-[ RECORD 9 ]----+---------------------
24140123456789abcdef | xxxxxxxxxxxxxxxxxx
24150123456789       | yy
2416-[ RECORD 10 ]---+---------------------
24170123456789abcdef | xxxxxxxxxxxxxxxxxxxx
24180123456789       |
2419
2420\pset format wrapped
2421execute q;
2422-[ RECORD 1 ]----+---------------------
24230123456789abcdef | xx
24240123456789       | yyyyyyyyyyyyyyyyyy
2425-[ RECORD 2 ]----+---------------------
24260123456789abcdef | xxxx
24270123456789       | yyyyyyyyyyyyyyyy
2428-[ RECORD 3 ]----+---------------------
24290123456789abcdef | xxxxxx
24300123456789       | yyyyyyyyyyyyyy
2431-[ RECORD 4 ]----+---------------------
24320123456789abcdef | xxxxxxxx
24330123456789       | yyyyyyyyyyyy
2434-[ RECORD 5 ]----+---------------------
24350123456789abcdef | xxxxxxxxxx
24360123456789       | yyyyyyyyyy
2437-[ RECORD 6 ]----+---------------------
24380123456789abcdef | xxxxxxxxxxxx
24390123456789       | yyyyyyyy
2440-[ RECORD 7 ]----+---------------------
24410123456789abcdef | xxxxxxxxxxxxxx
24420123456789       | yyyyyy
2443-[ RECORD 8 ]----+---------------------
24440123456789abcdef | xxxxxxxxxxxxxxxx
24450123456789       | yyyy
2446-[ RECORD 9 ]----+---------------------
24470123456789abcdef | xxxxxxxxxxxxxxxxxx
24480123456789       | yy
2449-[ RECORD 10 ]---+---------------------
24500123456789abcdef | xxxxxxxxxxxxxxxxxxxx
24510123456789       |
2452
2453\pset border 2
2454\pset format unaligned
2455execute q;
24560123456789abcdef|xx
24570123456789|yyyyyyyyyyyyyyyyyy
2458
24590123456789abcdef|xxxx
24600123456789|yyyyyyyyyyyyyyyy
2461
24620123456789abcdef|xxxxxx
24630123456789|yyyyyyyyyyyyyy
2464
24650123456789abcdef|xxxxxxxx
24660123456789|yyyyyyyyyyyy
2467
24680123456789abcdef|xxxxxxxxxx
24690123456789|yyyyyyyyyy
2470
24710123456789abcdef|xxxxxxxxxxxx
24720123456789|yyyyyyyy
2473
24740123456789abcdef|xxxxxxxxxxxxxx
24750123456789|yyyyyy
2476
24770123456789abcdef|xxxxxxxxxxxxxxxx
24780123456789|yyyy
2479
24800123456789abcdef|xxxxxxxxxxxxxxxxxx
24810123456789|yy
2482
24830123456789abcdef|xxxxxxxxxxxxxxxxxxxx
24840123456789|
2485\pset format aligned
2486execute q;
2487+-[ RECORD 1 ]-----+----------------------+
2488| 0123456789abcdef | xx                   |
2489| 0123456789       | yyyyyyyyyyyyyyyyyy   |
2490+-[ RECORD 2 ]-----+----------------------+
2491| 0123456789abcdef | xxxx                 |
2492| 0123456789       | yyyyyyyyyyyyyyyy     |
2493+-[ RECORD 3 ]-----+----------------------+
2494| 0123456789abcdef | xxxxxx               |
2495| 0123456789       | yyyyyyyyyyyyyy       |
2496+-[ RECORD 4 ]-----+----------------------+
2497| 0123456789abcdef | xxxxxxxx             |
2498| 0123456789       | yyyyyyyyyyyy         |
2499+-[ RECORD 5 ]-----+----------------------+
2500| 0123456789abcdef | xxxxxxxxxx           |
2501| 0123456789       | yyyyyyyyyy           |
2502+-[ RECORD 6 ]-----+----------------------+
2503| 0123456789abcdef | xxxxxxxxxxxx         |
2504| 0123456789       | yyyyyyyy             |
2505+-[ RECORD 7 ]-----+----------------------+
2506| 0123456789abcdef | xxxxxxxxxxxxxx       |
2507| 0123456789       | yyyyyy               |
2508+-[ RECORD 8 ]-----+----------------------+
2509| 0123456789abcdef | xxxxxxxxxxxxxxxx     |
2510| 0123456789       | yyyy                 |
2511+-[ RECORD 9 ]-----+----------------------+
2512| 0123456789abcdef | xxxxxxxxxxxxxxxxxx   |
2513| 0123456789       | yy                   |
2514+-[ RECORD 10 ]----+----------------------+
2515| 0123456789abcdef | xxxxxxxxxxxxxxxxxxxx |
2516| 0123456789       |                      |
2517+------------------+----------------------+
2518
2519\pset format wrapped
2520execute q;
2521+-[ RECORD 1 ]-----+-------------------+
2522| 0123456789abcdef | xx                |
2523| 0123456789       | yyyyyyyyyyyyyyyyy |
2524|                  ; y                 |
2525+-[ RECORD 2 ]-----+-------------------+
2526| 0123456789abcdef | xxxx              |
2527| 0123456789       | yyyyyyyyyyyyyyyy  |
2528+-[ RECORD 3 ]-----+-------------------+
2529| 0123456789abcdef | xxxxxx            |
2530| 0123456789       | yyyyyyyyyyyyyy    |
2531+-[ RECORD 4 ]-----+-------------------+
2532| 0123456789abcdef | xxxxxxxx          |
2533| 0123456789       | yyyyyyyyyyyy      |
2534+-[ RECORD 5 ]-----+-------------------+
2535| 0123456789abcdef | xxxxxxxxxx        |
2536| 0123456789       | yyyyyyyyyy        |
2537+-[ RECORD 6 ]-----+-------------------+
2538| 0123456789abcdef | xxxxxxxxxxxx      |
2539| 0123456789       | yyyyyyyy          |
2540+-[ RECORD 7 ]-----+-------------------+
2541| 0123456789abcdef | xxxxxxxxxxxxxx    |
2542| 0123456789       | yyyyyy            |
2543+-[ RECORD 8 ]-----+-------------------+
2544| 0123456789abcdef | xxxxxxxxxxxxxxxx  |
2545| 0123456789       | yyyy              |
2546+-[ RECORD 9 ]-----+-------------------+
2547| 0123456789abcdef | xxxxxxxxxxxxxxxxx |
2548|                  ; x                 |
2549| 0123456789       | yy                |
2550+-[ RECORD 10 ]----+-------------------+
2551| 0123456789abcdef | xxxxxxxxxxxxxxxxx |
2552|                  ; xxx               |
2553| 0123456789       |                   |
2554+------------------+-------------------+
2555
2556deallocate q;
2557\pset linestyle ascii
2558prepare q as select ' | = | lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (&' as " | -- | 012345678 9abc def!*@#&!@(*&*~~_+-=\ \", '11' as "0123456789", 11 as int from generate_series(1,10) as n;
2559\pset format asciidoc
2560\pset expanded off
2561\pset border 0
2562execute q;
2563
2564[options="header",cols="<l,<l,>l",frame="none",grid="none"]
2565|====
2566^l| \| -- \| 012345678 9abc def!*@#&!@(*&*~~_+-=\ \ ^l|0123456789 ^l|int
2567| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& |11 |11
2568| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& |11 |11
2569| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& |11 |11
2570| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& |11 |11
2571| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& |11 |11
2572| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& |11 |11
2573| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& |11 |11
2574| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& |11 |11
2575| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& |11 |11
2576| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& |11 |11
2577|====
2578
2579....
2580(10 rows)
2581....
2582\pset border 1
2583execute q;
2584
2585[options="header",cols="<l,<l,>l",frame="none"]
2586|====
2587^l| \| -- \| 012345678 9abc def!*@#&!@(*&*~~_+-=\ \ ^l|0123456789 ^l|int
2588| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& |11 |11
2589| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& |11 |11
2590| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& |11 |11
2591| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& |11 |11
2592| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& |11 |11
2593| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& |11 |11
2594| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& |11 |11
2595| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& |11 |11
2596| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& |11 |11
2597| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& |11 |11
2598|====
2599
2600....
2601(10 rows)
2602....
2603\pset border 2
2604execute q;
2605
2606[options="header",cols="<l,<l,>l",frame="all",grid="all"]
2607|====
2608^l| \| -- \| 012345678 9abc def!*@#&!@(*&*~~_+-=\ \ ^l|0123456789 ^l|int
2609| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& |11 |11
2610| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& |11 |11
2611| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& |11 |11
2612| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& |11 |11
2613| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& |11 |11
2614| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& |11 |11
2615| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& |11 |11
2616| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& |11 |11
2617| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& |11 |11
2618| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& |11 |11
2619|====
2620
2621....
2622(10 rows)
2623....
2624\pset expanded on
2625\pset border 0
2626execute q;
2627
2628[cols="h,l",frame="none",grid="none"]
2629|====
26302+^|Record 1
2631<l| \| -- \| 012345678 9abc def!*@#&!@(*&*~~_+-=\ \ <l| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (&
2632<l|0123456789 <l|11
2633<l|int >l|11
26342+^|Record 2
2635<l| \| -- \| 012345678 9abc def!*@#&!@(*&*~~_+-=\ \ <l| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (&
2636<l|0123456789 <l|11
2637<l|int >l|11
26382+^|Record 3
2639<l| \| -- \| 012345678 9abc def!*@#&!@(*&*~~_+-=\ \ <l| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (&
2640<l|0123456789 <l|11
2641<l|int >l|11
26422+^|Record 4
2643<l| \| -- \| 012345678 9abc def!*@#&!@(*&*~~_+-=\ \ <l| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (&
2644<l|0123456789 <l|11
2645<l|int >l|11
26462+^|Record 5
2647<l| \| -- \| 012345678 9abc def!*@#&!@(*&*~~_+-=\ \ <l| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (&
2648<l|0123456789 <l|11
2649<l|int >l|11
26502+^|Record 6
2651<l| \| -- \| 012345678 9abc def!*@#&!@(*&*~~_+-=\ \ <l| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (&
2652<l|0123456789 <l|11
2653<l|int >l|11
26542+^|Record 7
2655<l| \| -- \| 012345678 9abc def!*@#&!@(*&*~~_+-=\ \ <l| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (&
2656<l|0123456789 <l|11
2657<l|int >l|11
26582+^|Record 8
2659<l| \| -- \| 012345678 9abc def!*@#&!@(*&*~~_+-=\ \ <l| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (&
2660<l|0123456789 <l|11
2661<l|int >l|11
26622+^|Record 9
2663<l| \| -- \| 012345678 9abc def!*@#&!@(*&*~~_+-=\ \ <l| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (&
2664<l|0123456789 <l|11
2665<l|int >l|11
26662+^|Record 10
2667<l| \| -- \| 012345678 9abc def!*@#&!@(*&*~~_+-=\ \ <l| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (&
2668<l|0123456789 <l|11
2669<l|int >l|11
2670|====
2671\pset border 1
2672execute q;
2673
2674[cols="h,l",frame="none"]
2675|====
26762+^|Record 1
2677<l| \| -- \| 012345678 9abc def!*@#&!@(*&*~~_+-=\ \ <l| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (&
2678<l|0123456789 <l|11
2679<l|int >l|11
26802+^|Record 2
2681<l| \| -- \| 012345678 9abc def!*@#&!@(*&*~~_+-=\ \ <l| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (&
2682<l|0123456789 <l|11
2683<l|int >l|11
26842+^|Record 3
2685<l| \| -- \| 012345678 9abc def!*@#&!@(*&*~~_+-=\ \ <l| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (&
2686<l|0123456789 <l|11
2687<l|int >l|11
26882+^|Record 4
2689<l| \| -- \| 012345678 9abc def!*@#&!@(*&*~~_+-=\ \ <l| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (&
2690<l|0123456789 <l|11
2691<l|int >l|11
26922+^|Record 5
2693<l| \| -- \| 012345678 9abc def!*@#&!@(*&*~~_+-=\ \ <l| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (&
2694<l|0123456789 <l|11
2695<l|int >l|11
26962+^|Record 6
2697<l| \| -- \| 012345678 9abc def!*@#&!@(*&*~~_+-=\ \ <l| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (&
2698<l|0123456789 <l|11
2699<l|int >l|11
27002+^|Record 7
2701<l| \| -- \| 012345678 9abc def!*@#&!@(*&*~~_+-=\ \ <l| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (&
2702<l|0123456789 <l|11
2703<l|int >l|11
27042+^|Record 8
2705<l| \| -- \| 012345678 9abc def!*@#&!@(*&*~~_+-=\ \ <l| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (&
2706<l|0123456789 <l|11
2707<l|int >l|11
27082+^|Record 9
2709<l| \| -- \| 012345678 9abc def!*@#&!@(*&*~~_+-=\ \ <l| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (&
2710<l|0123456789 <l|11
2711<l|int >l|11
27122+^|Record 10
2713<l| \| -- \| 012345678 9abc def!*@#&!@(*&*~~_+-=\ \ <l| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (&
2714<l|0123456789 <l|11
2715<l|int >l|11
2716|====
2717\pset border 2
2718execute q;
2719
2720[cols="h,l",frame="all",grid="all"]
2721|====
27222+^|Record 1
2723<l| \| -- \| 012345678 9abc def!*@#&!@(*&*~~_+-=\ \ <l| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (&
2724<l|0123456789 <l|11
2725<l|int >l|11
27262+^|Record 2
2727<l| \| -- \| 012345678 9abc def!*@#&!@(*&*~~_+-=\ \ <l| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (&
2728<l|0123456789 <l|11
2729<l|int >l|11
27302+^|Record 3
2731<l| \| -- \| 012345678 9abc def!*@#&!@(*&*~~_+-=\ \ <l| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (&
2732<l|0123456789 <l|11
2733<l|int >l|11
27342+^|Record 4
2735<l| \| -- \| 012345678 9abc def!*@#&!@(*&*~~_+-=\ \ <l| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (&
2736<l|0123456789 <l|11
2737<l|int >l|11
27382+^|Record 5
2739<l| \| -- \| 012345678 9abc def!*@#&!@(*&*~~_+-=\ \ <l| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (&
2740<l|0123456789 <l|11
2741<l|int >l|11
27422+^|Record 6
2743<l| \| -- \| 012345678 9abc def!*@#&!@(*&*~~_+-=\ \ <l| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (&
2744<l|0123456789 <l|11
2745<l|int >l|11
27462+^|Record 7
2747<l| \| -- \| 012345678 9abc def!*@#&!@(*&*~~_+-=\ \ <l| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (&
2748<l|0123456789 <l|11
2749<l|int >l|11
27502+^|Record 8
2751<l| \| -- \| 012345678 9abc def!*@#&!@(*&*~~_+-=\ \ <l| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (&
2752<l|0123456789 <l|11
2753<l|int >l|11
27542+^|Record 9
2755<l| \| -- \| 012345678 9abc def!*@#&!@(*&*~~_+-=\ \ <l| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (&
2756<l|0123456789 <l|11
2757<l|int >l|11
27582+^|Record 10
2759<l| \| -- \| 012345678 9abc def!*@#&!@(*&*~~_+-=\ \ <l| \| = \| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (&
2760<l|0123456789 <l|11
2761<l|int >l|11
2762|====
2763deallocate q;
2764\pset format aligned
2765\pset expanded off
2766\pset border 1
2767-- tests for \if ... \endif
2768\if true
2769  select 'okay';
2770 ?column?
2771----------
2772 okay
2773(1 row)
2774
2775  select 'still okay';
2776  ?column?
2777------------
2778 still okay
2779(1 row)
2780
2781\else
2782  not okay;
2783  still not okay
2784\endif
2785-- at this point query buffer should still have last valid line
2786\g
2787  ?column?
2788------------
2789 still okay
2790(1 row)
2791
2792-- \if should work okay on part of a query
2793select
2794  \if true
2795    42
2796  \else
2797    (bogus
2798  \endif
2799  forty_two;
2800 forty_two
2801-----------
2802        42
2803(1 row)
2804
2805select \if false \\ (bogus \else \\ 42 \endif \\ forty_two;
2806 forty_two
2807-----------
2808        42
2809(1 row)
2810
2811-- test a large nested if using a variety of true-equivalents
2812\if true
2813	\if 1
2814		\if yes
2815			\if on
2816				\echo 'all true'
2817all true
2818			\else
2819				\echo 'should not print #1-1'
2820			\endif
2821		\else
2822			\echo 'should not print #1-2'
2823		\endif
2824	\else
2825		\echo 'should not print #1-3'
2826	\endif
2827\else
2828	\echo 'should not print #1-4'
2829\endif
2830-- test a variety of false-equivalents in an if/elif/else structure
2831\if false
2832	\echo 'should not print #2-1'
2833\elif 0
2834	\echo 'should not print #2-2'
2835\elif no
2836	\echo 'should not print #2-3'
2837\elif off
2838	\echo 'should not print #2-4'
2839\else
2840	\echo 'all false'
2841all false
2842\endif
2843-- test simple true-then-else
2844\if true
2845	\echo 'first thing true'
2846first thing true
2847\else
2848	\echo 'should not print #3-1'
2849\endif
2850-- test simple false-true-else
2851\if false
2852	\echo 'should not print #4-1'
2853\elif true
2854	\echo 'second thing true'
2855second thing true
2856\else
2857	\echo 'should not print #5-1'
2858\endif
2859-- invalid boolean expressions are false
2860\if invalid boolean expression
2861unrecognized value "invalid boolean expression" for "\if expression": Boolean expected
2862	\echo 'will not print #6-1'
2863\else
2864	\echo 'will print anyway #6-2'
2865will print anyway #6-2
2866\endif
2867-- test un-matched endif
2868\endif
2869\endif: no matching \if
2870-- test un-matched else
2871\else
2872\else: no matching \if
2873-- test un-matched elif
2874\elif
2875\elif: no matching \if
2876-- test double-else error
2877\if true
2878\else
2879\else
2880\else: cannot occur after \else
2881\endif
2882-- test elif out-of-order
2883\if false
2884\else
2885\elif
2886\elif: cannot occur after \else
2887\endif
2888-- test if-endif matching in a false branch
2889\if false
2890    \if false
2891        \echo 'should not print #7-1'
2892    \else
2893        \echo 'should not print #7-2'
2894    \endif
2895    \echo 'should not print #7-3'
2896\else
2897    \echo 'should print #7-4'
2898should print #7-4
2899\endif
2900-- show that vars and backticks are not expanded when ignoring extra args
2901\set foo bar
2902\echo :foo :'foo' :"foo"
2903bar 'bar' "bar"
2904\pset fieldsep | `nosuchcommand` :foo :'foo' :"foo"
2905\pset: extra argument "nosuchcommand" ignored
2906\pset: extra argument ":foo" ignored
2907\pset: extra argument ":'foo'" ignored
2908\pset: extra argument ":"foo"" ignored
2909-- show that vars and backticks are not expanded and commands are ignored
2910-- when in a false if-branch
2911\set try_to_quit '\\q'
2912\if false
2913	:try_to_quit
2914	\echo `nosuchcommand` :foo :'foo' :"foo"
2915	\pset fieldsep | `nosuchcommand` :foo :'foo' :"foo"
2916	\a \C arg1 \c arg1 arg2 arg3 arg4 \cd arg1 \conninfo
2917	\copy arg1 arg2 arg3 arg4 arg5 arg6
2918	\copyright \dt arg1 \e arg1 arg2
2919	\ef whole_line
2920	\ev whole_line
2921	\echo arg1 arg2 arg3 arg4 arg5 \echo arg1 \encoding arg1 \errverbose
2922	\g arg1 \gx arg1 \gexec \h \html \i arg1 \ir arg1 \l arg1 \lo arg1 arg2
2923	\o arg1 \p \password arg1 \prompt arg1 arg2 \pset arg1 arg2 \q
2924	\reset \s arg1 \set arg1 arg2 arg3 arg4 arg5 arg6 arg7 \setenv arg1 arg2
2925	\sf whole_line
2926	\sv whole_line
2927	\t arg1 \T arg1 \timing arg1 \unset arg1 \w arg1 \watch arg1 \x arg1
2928	-- \else here is eaten as part of OT_FILEPIPE argument
2929	\w |/no/such/file \else
2930	-- \endif here is eaten as part of whole-line argument
2931	\! whole_line \endif
2932\else
2933	\echo 'should print #8-1'
2934should print #8-1
2935\endif
2936-- SHOW_CONTEXT
2937\set SHOW_CONTEXT never
2938do $$
2939begin
2940  raise notice 'foo';
2941  raise exception 'bar';
2942end $$;
2943NOTICE:  foo
2944ERROR:  bar
2945\set SHOW_CONTEXT errors
2946do $$
2947begin
2948  raise notice 'foo';
2949  raise exception 'bar';
2950end $$;
2951NOTICE:  foo
2952ERROR:  bar
2953CONTEXT:  PL/pgSQL function inline_code_block line 4 at RAISE
2954\set SHOW_CONTEXT always
2955do $$
2956begin
2957  raise notice 'foo';
2958  raise exception 'bar';
2959end $$;
2960NOTICE:  foo
2961CONTEXT:  PL/pgSQL function inline_code_block line 3 at RAISE
2962ERROR:  bar
2963CONTEXT:  PL/pgSQL function inline_code_block line 4 at RAISE
2964-- test printing and clearing the query buffer
2965SELECT 1;
2966 ?column?
2967----------
2968        1
2969(1 row)
2970
2971\p
2972SELECT 1;
2973SELECT 2 \r
2974\p
2975SELECT 1;
2976SELECT 3 \p
2977SELECT 3
2978UNION SELECT 4 \p
2979SELECT 3
2980UNION SELECT 4
2981UNION SELECT 5
2982ORDER BY 1;
2983 ?column?
2984----------
2985        3
2986        4
2987        5
2988(3 rows)
2989
2990\r
2991\p
2992SELECT 3
2993UNION SELECT 4
2994UNION SELECT 5
2995ORDER BY 1;
2996