Re: printing table in asciidoc with psql

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Szymon Guz <mabewlun(at)gmail(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: printing table in asciidoc with psql
Date: 2015-03-24 19:52:26
Message-ID: 20150324195226.GB17097@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Mar 24, 2015 at 11:15:33AM +0900, Michael Paquier wrote:
> On Tue, Mar 24, 2015 at 8:44 AM, Bruce Momjian wrote:
> > Notice the added 'l' next to the '<'. Updated patch attached. Any
> > other issues?
>
> Ah, right. That's a good catch and your patch fixes the issue. Still,
> there are problems with the tuple-only mode and the expanded mode. For
> example using this example (wanted over-complicated):
> create table "5 2.2+^.^" ("5 2.2+^.^" text, "4 2.2+^.^" text);
> insert into "5 2.2+^.^" values ('5 2.2+^.^', '4 2.2+^.^');
> insert into "5 2.2+^.^" values ('2 2.2+^.^', '3 2.2+^.^');
> \pset format asciidoc

OK, all fixed. Some of the bugs were original, but at least one was
introduced by me. Patch attached. New output:

---------------------------------------------------------------------------

test=> \pset format asciidoc
Output format is asciidoc.
test=> table "5 2.2+^.^" ;

[options="header",cols="<l,<l",frame="none"]
|====
^l|5 2.2+^.^ ^l|4 2.2+^.^
|5 2.2+^.^ |4 2.2+^.^
|2 2.2+^.^ |3 2.2+^.^
|====

....
(2 rows)
....
test=> \x
Expanded display is on.
test=> table "5 2.2+^.^" ;

[cols="h,l",frame="none"]
|====
2+^|Record 1
<l|5 2.2+^.^ <l|5 2.2+^.^
<l|4 2.2+^.^ <l|4 2.2+^.^
2+^|Record 2
<l|5 2.2+^.^ <l|2 2.2+^.^
<l|4 2.2+^.^ <l|3 2.2+^.^
|====
test=> \x
Expanded display is off.
test=> \t
Tuples only is on.
test=> table "5 2.2+^.^" ;

[options="header",cols="<l,<l",frame="none"]
|====
|5 2.2+^.^ |4 2.2+^.^
|2 2.2+^.^ |3 2.2+^.^
|====

test=> \x
Expanded display is on.
test=> table "5 2.2+^.^" ;

[cols="h,l",frame="none"]
|====
2+|
<l|5 2.2+^.^ <l|5 2.2+^.^
<l|4 2.2+^.^ <l|4 2.2+^.^
2+|
<l|5 2.2+^.^ <l|2 2.2+^.^
<l|4 2.2+^.^ <l|3 2.2+^.^
|====

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ Everyone has their own god. +

Attachment Content-Type Size
asciidoc.diff text/x-diff 19.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2015-03-24 19:56:27 Re: EvalPlanQual behaves oddly for FDW queries involving system columns
Previous Message Fabrízio de Royes Mello 2015-03-24 19:28:45 Re: Order of enforcement of CHECK constraints?