Re: patch: psql - enforce constant width of last column - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: patch: psql - enforce constant width of last column
Date
Msg-id CAFj8pRCBj+ybGbOmAyHW4f-Ho4AJ2k=4Mj2ymYxCB2m7t9qyiA@mail.gmail.com
Whole thread Raw
In response to Re: patch: psql - enforce constant width of last column  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hi

po 4. 11. 2019 v 21:55 odesílatel Tom Lane <tgl@sss.pgh.pa.us> napsal:
Pavel Stehule <pavel.stehule@gmail.com> writes:
> st 18. 9. 2019 v 12:52 odesílatel Ahsan Hadi <ahsan.hadi@gmail.com> napsal:
>> does this patch have any value for psql without pspg?

> The benefit of this patch is just for pspg users today.

TBH, I think we should just reject this patch.  It makes psql's
table-printing behavior even more complicated than it was before.
And I don't see how pspg gets any benefit --- you'll still have
to deal with the old code, for an indefinite time into the future.

I don't think so it increase printing rules too much. A default value "auto" doesn't any change against current state, "always" ensure same line width of any row.

The problem, that this patch try to solve, is different width of rows - although the result is aligned.

Personally I think so current behave is not correct. Correct solution should be set "finalspaces true" every time - for aligned output. But I don't know a motivation of authors and as solution with minimal impacts I wrote a possibility to set (it's not default) to finalspace to "always" as fix of some possible visual artefact (although these artefacts are almost time invisible).

The patch maybe looks not trivial (although it is trivial), but it is due I try to reduce possible impact on any other application to zero.
 

Moreover, *other* programs that pay close attention to the output
format will be forced to deal with the possibility that this flag
has been turned on, which typically they wouldn't even have a way
to find out.  So I think you're basically trying to export your
problems onto everyone else.

I try to fix this issue where this issue coming. For this patch is important to get a agreement (or not) if this problem is a issue that should be fixed.

I think so in aligned mode all rows should to have same width.

On second hand, really I don't know why the last space is not printed, and if some applications had a problem with it. I have not any idea. Current code where last spaces are not printed is little bit complex than if the align was really complete.

Sure, "the issue of last invisible space" is not big issue (it's triviality) - I really think so it should be fixed on psql side, but if there will not be a agreement, I can fix it on pspg side (although it will not be elegant - because I have to print chars that doesn't exists).

Is here any man who remember this implementation, who can say, why the code is implemented how it is implemented?

Regards

Pavel



                        regards, tom lane

pgsql-hackers by date:

Previous
From: Thomas Munro
Date:
Subject: Re: ssl passphrase callback
Next
From: Thomas Munro
Date:
Subject: Re: [Patch] Add a reset_computed_values function in pg_stat_statements