Re: printing table in asciidoc with psql

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
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-22 11:06:17
Message-ID: CAB7nPqSa2O53H31Kt3+cv7Etk3H20SnbgOE2LeeUWKZENrXxrg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Mar 22, 2015 at 10:09 AM, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
> On Sat, Mar 21, 2015 at 09:20:03PM +0900, Michael Paquier wrote:
>> This does not work:
>> =# create table "5 2.2+^.^" ();
>> CREATE TABLE
>> =# \pset format asciidoc
>> Output format is asciidoc.
>> =# \d
>>
>> .List of relations
>> [options="header",cols="<l,<l,<l,<l",frame="none"]
>> |====
>> ^l|Schema ^l|Name ^l|Type ^l|Owner
>> |public|5 2.2+^.^|table|ioltas
>> |====
>>
>> ....
>> (1 row)
>> ....
>>
>> I think that we should really put additional spaces on the left side
>> of the column separators "|". For example, this line:
>> |public|5 2.2+^.^|table|ioltas
>> should become that:
>> |public |5 2.2+^.^ |table |ioltas
>> And there is no problem.
>
> 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+^.^

Regards,
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Christoph Berg 2015-03-22 11:17:57 Re: PITR failing to stop before DROP DATABASE
Previous Message Pavel Stehule 2015-03-22 10:57:42 Re: proposal: searching in array function - array_position