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-23 23:44:35
Message-ID: 20150323234435.GB11352@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Mar 22, 2015 at 08:06:17PM +0900, Michael Paquier wrote:
> > I have updated the attached patch to do as you suggested. Please also
> > test the \x output. Thanks.
>
> Indeed. If I use a specific column name like this one, I am seeing
> problems with the expanded mode:
> =# create table "5 2.2+^.^" ("5 2.2+^.^" int);
> CREATE TABLE
> =# \x
> Expanded display is on.
> =# INSERT INTO "5 2.2+^.^" VALUES (1);
> INSERT 0 1
> =# table "5 2.2+^.^";
>
> [cols="h,l",frame="none"]
> |====
> 2+^|Record 1
> <|5 2.2+^.^ >|1
> |====
>
> In this case the record is printed like that:
> 5 2.2+.
> While it should show up like that:
> 5 2.2+^.^

OK, fixed. It turns out you need to specify the style on each output
row ('l'/literal) so that a later data value of ^.^ is not intepreted as
a horizontal/vertial alignment specification. (Wow, it sounds like I
know what I am talking about. ;-) )

The new output is:

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

[cols="h,l",frame="none"]
|====
2+^|Record 1
--> <l|5 2.2+^.^ >|1
|====

Notice the added 'l' next to the '<'. Updated patch attached. Any
other issues?

--
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 Robert Haas 2015-03-24 00:47:55 Re: Abbreviated keys for Numeric
Previous Message Peter Geoghegan 2015-03-23 23:17:16 Re: Abbreviated keys for Numeric