Thread: [HACKERS] Other formats in pset like markdown, rst, mediawiki

From:
Jan Michálek
Date:

Have a nice day
I`m using \pset format html for generating tables for some documentation, training, reports, blogs... Mainly sample of data for SQL queries, or explaining structure etc.
But in some software like sphinx, wiki on redmine, or markdown on github issues I`m not able to insert table in html into text. Using some converters or sed script is little bit tricky if I need to create reports from bash scripts, for example by jenkins.
Is there posibility, that support for some others formats will be added in the future? Or id posible to create some of this formats by manipulating with pset? Or I need use xml for export and use some xslt templates, or lxml etc. to create format that I will be able to copy on wiki page or in github issue.

Thanks Je;

--
Jelen
Starší čeledín datovýho chlíva
From:
Michael Paquier
Date:

On Thu, Feb 23, 2017 at 7:29 PM, Jan Michálek <> wrote:
> Is there possibility, that support for some others formats will be added in
> the future? Or is it possible to create some of this formats by manipulating
> with pset?

Addition of new formats is definitely possible, the latest one added
was asciidoc from two years back that I spent some time playing with:
- thread: https://www.postgresql.org/message-id/CAFjNrYsppN=
- commit: http://git.postgresql.org/pg/commitdiff/9d9991c84e64c0c5f568b3cdaf46bb91a1368b5a
If you want to submit patches in this area you can get inspiration
from this example, such changes are rather mechanical.
--
Michael



From:
Alvaro Herrera
Date:

Jan Michálek wrote:

> Is there posibility, that support for some others formats will be added in
> the future? Or id posible to create some of this formats by manipulating
> with pset? Or I need use xml for export and use some xslt templates, or
> lxml etc. to create format that I will be able to copy on wiki page or in
> github issue.

I would love to have something that generates Markdown tables.  One of
the goals of psql is to make common tasks easy, and IMO generating
tables in formats commonly used in documents is one such task.

I think we discussed the idea of Markdown awhile ago, and eventually
found out that you absolutely need to align things following some crazy
rules, or the markdown processor just gives up on them.  (It works fine
for simple table contents, but if you have to escape a character
somewhere, then the alignment needs to subtract the escaping character,
or something like that)

The pandoc document http://pandoc.org/MANUAL.html#tables appears to
suggest we could use "pipe tables" to get rid of the alignment
requirement, but then the result is ugly.  It's a pity that multiline
rows don't work in that mode, also.

If you come up with code to generate good pandoc Markdown tables, I am
happy to help.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



From:
Alvaro Herrera
Date:

Leknín Řepánek wrote:
> I was mainly using tables in rst, i think, that this format is very
> similar to "grid tables" in markdown. And it is really similar to default borders used
> in psql with border 2.

Great.  So are you writing the code now?  :-)

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



From:
Jan Michálek
Date:

I can try it, doesn`t look dificult, but I`m worry, that I`m not able to write clean, pretty code.

2017-02-23 18:03 GMT+01:00 Alvaro Herrera <>:
Leknín Řepánek wrote:
> I was mainly using tables in rst, i think, that this format is very
> similar to "grid tables" in markdown. And it is really similar to default borders used
> in psql with border 2.

Great.  So are you writing the code now?  :-)

--
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



--
Jelen
Starší čeledín datovýho chlíva
From:
Leknín Řepánek
Date:

I was mainly using tables in rst, i think, that this format is very
similar to "grid tables" in markdown. And it is really similar to default borders used
in psql with border 2.

On Thu, Feb 23, 2017 at 12:06:36PM -0300, Alvaro Herrera wrote:
> Jan Michálek wrote:
> 
> > Is there posibility, that support for some others formats will be added in
> > the future? Or id posible to create some of this formats by manipulating
> > with pset? Or I need use xml for export and use some xslt templates, or
> > lxml etc. to create format that I will be able to copy on wiki page or in
> > github issue.
> 
> I would love to have something that generates Markdown tables.  One of
> the goals of psql is to make common tasks easy, and IMO generating
> tables in formats commonly used in documents is one such task.
> 
> I think we discussed the idea of Markdown awhile ago, and eventually
> found out that you absolutely need to align things following some crazy
> rules, or the markdown processor just gives up on them.  (It works fine
> for simple table contents, but if you have to escape a character
> somewhere, then the alignment needs to subtract the escaping character,
> or something like that)
> 
> The pandoc document http://pandoc.org/MANUAL.html#tables appears to
> suggest we could use "pipe tables" to get rid of the alignment
> requirement, but then the result is ugly.  It's a pity that multiline
> rows don't work in that mode, also.
> 
> If you come up with code to generate good pandoc Markdown tables, I am
> happy to help.
> 
> -- 
> Álvaro Herrera                https://www.2ndQuadrant.com/
> PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



From:
Pavel Stehule
Date:



2017-02-23 19:09 GMT+01:00 Jan Michálek <>:
I can try it, doesn`t look dificult, but I`m worry, that I`m not able to write clean, pretty code.

It is not a problem, there is lot of iteration for code cleaning

Regards

Pavel 

2017-02-23 18:03 GMT+01:00 Alvaro Herrera <>:
Leknín Řepánek wrote:
> I was mainly using tables in rst, i think, that this format is very
> similar to "grid tables" in markdown. And it is really similar to default borders used
> in psql with border 2.

Great.  So are you writing the code now?  :-)

--
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



--
Jelen
Starší čeledín datovýho chlíva

From:
Michael Paquier
Date:

On Fri, Feb 24, 2017 at 3:09 AM, Jan Michálek <> wrote:
> I can try it, doesn`t look dificult, but I`m worry, that I`m not able to
> write clean, pretty code.

If you want to have something available in Postgres 10, you had better
be quick. The last commit fest of the development cycle of Postgres 10
begins on the 1st of March, you need to to register your patch here:
https://commitfest.postgresql.org/13/
Here are also some rough guidelines about submitting a patch:
https://wiki.postgresql.org/wiki/Submitting_a_Patch
--
Michael



From:
Jan Michálek
Date:

Current state is something like this (diff is attached).
I currently haven`t regression test, tab completion etc., I will add this thing following structure of asciidoc commit.

Output is tested using retext, rst is OK, md have problem with cells with newline (i must find out, how it is possible create table with this in markdown).

[jelen@laptak patch_postgre_rst]$
[jelen@laptak psql]$ ./psql
psql (9.6.2, server 9.6.1)
Type "help" for help.

jelen=# \pset linestyle markdown
Line style is markdown.
jelen=# values(E'nasral Franta\nna trabanta','Žluťoučký kobyly'), ('''',E'a\tb') \g | xclip
jelen=# values(E'nasral Franta\nna trabanta','Žluťoučký kobyly'), ('''',E'a\tb') \g

|    column1    |     column2      |
|---------------|------------------|
| nasral Franta | Žluťoučký kobyly |
| na trabanta   |                  |
| '             | a       b        |


(2 rows)

jelen=# \pset linestyle rst
Line style is rst.
jelen=# values(E'nasral Franta\nna trabanta','Žluťoučký kobyly'), ('''',E'a\tb') \g
+---------------+------------------+
|    column1    |     column2      |
+===============+==================+
| nasral Franta+| Žluťoučký kobyly |
| na trabanta   |                  |
+---------------+------------------+
| '             | a       b        |
+---------------+------------------+

(2 rows)

jelen=#


2017-02-24 0:46 GMT+01:00 Michael Paquier <>:
On Fri, Feb 24, 2017 at 3:09 AM, Jan Michálek <> wrote:
> I can try it, doesn`t look dificult, but I`m worry, that I`m not able to
> write clean, pretty code.

If you want to have something available in Postgres 10, you had better
be quick. The last commit fest of the development cycle of Postgres 10
begins on the 1st of March, you need to to register your patch here:
https://commitfest.postgresql.org/13/
Here are also some rough guidelines about submitting a patch:
https://wiki.postgresql.org/wiki/Submitting_a_Patch
--
Michael



--
Jelen
Starší čeledín datovýho chlíva
From:
Jan Michálek
Date:

There it is, what i have.
I need i small help with psql.out, because \pset format wrapped. I don`t know, how to have it in fixed width.

2017-02-28 14:23 GMT+01:00 Jan Michálek <>:
Current state is something like this (diff is attached).
I currently haven`t regression test, tab completion etc., I will add this thing following structure of asciidoc commit.

Output is tested using retext, rst is OK, md have problem with cells with newline (i must find out, how it is possible create table with this in markdown).

[jelen@laptak patch_postgre_rst]$
[jelen@laptak psql]$ ./psql
psql (9.6.2, server 9.6.1)
Type "help" for help.

jelen=# \pset linestyle markdown
Line style is markdown.
jelen=# values(E'nasral Franta\nna trabanta','Žluťoučký kobyly'), ('''',E'a\tb') \g | xclip
jelen=# values(E'nasral Franta\nna trabanta','Žluťoučký kobyly'), ('''',E'a\tb') \g

|    column1    |     column2      |
|---------------|------------------|
| nasral Franta | Žluťoučký kobyly |
| na trabanta   |                  |
| '             | a       b        |


(2 rows)

jelen=# \pset linestyle rst
Line style is rst.
jelen=# values(E'nasral Franta\nna trabanta','Žluťoučký kobyly'), ('''',E'a\tb') \g
+---------------+------------------+
|    column1    |     column2      |
+===============+==================+
| nasral Franta+| Žluťoučký kobyly |
| na trabanta   |                  |
+---------------+------------------+
| '             | a       b        |
+---------------+------------------+

(2 rows)

jelen=#


2017-02-24 0:46 GMT+01:00 Michael Paquier <>:
On Fri, Feb 24, 2017 at 3:09 AM, Jan Michálek <> wrote:
> I can try it, doesn`t look dificult, but I`m worry, that I`m not able to
> write clean, pretty code.

If you want to have something available in Postgres 10, you had better
be quick. The last commit fest of the development cycle of Postgres 10
begins on the 1st of March, you need to to register your patch here:
https://commitfest.postgresql.org/13/
Here are also some rough guidelines about submitting a patch:
https://wiki.postgresql.org/wiki/Submitting_a_Patch
--
Michael



--
Jelen
Starší čeledín datovýho chlíva



--
Jelen
Starší čeledín datovýho chlíva
From:
Jan Michálek
Date:

Sorry, I have some errors in my diff, i had copy something from bad folder. I will fix it.

2017-03-01 0:27 GMT+01:00 Jan Michálek <>:
There it is, what i have.
I need i small help with psql.out, because \pset format wrapped. I don`t know, how to have it in fixed width.

2017-02-28 14:23 GMT+01:00 Jan Michálek <>:
Current state is something like this (diff is attached).
I currently haven`t regression test, tab completion etc., I will add this thing following structure of asciidoc commit.

Output is tested using retext, rst is OK, md have problem with cells with newline (i must find out, how it is possible create table with this in markdown).

[jelen@laptak patch_postgre_rst]$
[jelen@laptak psql]$ ./psql
psql (9.6.2, server 9.6.1)
Type "help" for help.

jelen=# \pset linestyle markdown
Line style is markdown.
jelen=# values(E'nasral Franta\nna trabanta','Žluťoučký kobyly'), ('''',E'a\tb') \g | xclip
jelen=# values(E'nasral Franta\nna trabanta','Žluťoučký kobyly'), ('''',E'a\tb') \g

|    column1    |     column2      |
|---------------|------------------|
| nasral Franta | Žluťoučký kobyly |
| na trabanta   |                  |
| '             | a       b        |


(2 rows)

jelen=# \pset linestyle rst
Line style is rst.
jelen=# values(E'nasral Franta\nna trabanta','Žluťoučký kobyly'), ('''',E'a\tb') \g
+---------------+------------------+
|    column1    |     column2      |
+===============+==================+
| nasral Franta+| Žluťoučký kobyly |
| na trabanta   |                  |
+---------------+------------------+
| '             | a       b        |
+---------------+------------------+

(2 rows)

jelen=#


2017-02-24 0:46 GMT+01:00 Michael Paquier <>:
On Fri, Feb 24, 2017 at 3:09 AM, Jan Michálek <> wrote:
> I can try it, doesn`t look dificult, but I`m worry, that I`m not able to
> write clean, pretty code.

If you want to have something available in Postgres 10, you had better
be quick. The last commit fest of the development cycle of Postgres 10
begins on the 1st of March, you need to to register your patch here:
https://commitfest.postgresql.org/13/
Here are also some rough guidelines about submitting a patch:
https://wiki.postgresql.org/wiki/Submitting_a_Patch
--
Michael



--
Jelen
Starší čeledín datovýho chlíva



--
Jelen
Starší čeledín datovýho chlíva



--
Jelen
Starší čeledín datovýho chlíva
From:
Jan Michálek
Date:

Regression test corrected.

2017-03-01 11:43 GMT+01:00 Jan Michálek <>:
Sorry, I have some errors in my diff, i had copy something from bad folder. I will fix it.

2017-03-01 0:27 GMT+01:00 Jan Michálek <>:
There it is, what i have.
I need i small help with psql.out, because \pset format wrapped. I don`t know, how to have it in fixed width.

2017-02-28 14:23 GMT+01:00 Jan Michálek <>:
Current state is something like this (diff is attached).
I currently haven`t regression test, tab completion etc., I will add this thing following structure of asciidoc commit.

Output is tested using retext, rst is OK, md have problem with cells with newline (i must find out, how it is possible create table with this in markdown).

[jelen@laptak patch_postgre_rst]$
[jelen@laptak psql]$ ./psql
psql (9.6.2, server 9.6.1)
Type "help" for help.

jelen=# \pset linestyle markdown
Line style is markdown.
jelen=# values(E'nasral Franta\nna trabanta','Žluťoučký kobyly'), ('''',E'a\tb') \g | xclip
jelen=# values(E'nasral Franta\nna trabanta','Žluťoučký kobyly'), ('''',E'a\tb') \g

|    column1    |     column2      |
|---------------|------------------|
| nasral Franta | Žluťoučký kobyly |
| na trabanta   |                  |
| '             | a       b        |


(2 rows)

jelen=# \pset linestyle rst
Line style is rst.
jelen=# values(E'nasral Franta\nna trabanta','Žluťoučký kobyly'), ('''',E'a\tb') \g
+---------------+------------------+
|    column1    |     column2      |
+===============+==================+
| nasral Franta+| Žluťoučký kobyly |
| na trabanta   |                  |
+---------------+------------------+
| '             | a       b        |
+---------------+------------------+

(2 rows)

jelen=#


2017-02-24 0:46 GMT+01:00 Michael Paquier <>:
On Fri, Feb 24, 2017 at 3:09 AM, Jan Michálek <> wrote:
> I can try it, doesn`t look dificult, but I`m worry, that I`m not able to
> write clean, pretty code.

If you want to have something available in Postgres 10, you had better
be quick. The last commit fest of the development cycle of Postgres 10
begins on the 1st of March, you need to to register your patch here:
https://commitfest.postgresql.org/13/
Here are also some rough guidelines about submitting a patch:
https://wiki.postgresql.org/wiki/Submitting_a_Patch
--
Michael



--
Jelen
Starší čeledín datovýho chlíva



--
Jelen
Starší čeledín datovýho chlíva



--
Jelen
Starší čeledín datovýho chlíva



--
Jelen
Starší čeledín datovýho chlíva
From:
Peter Eisentraut
Date:

If you want to implement a new table format, you should be looking at
\pset format, not \pset linestyle.  \pset format sets different table
formats, such as html, latex, and asciidoc.  \pset linestyle just
chooses between different styles for the plain-text table format.

On 3/1/17 06:31, Jan Michálek wrote:
> Regression test corrected.
> 
> 2017-03-01 11:43 GMT+01:00 Jan Michálek <
> <mailto:>>:
> 
>     Sorry, I have some errors in my diff, i had copy something from bad
>     folder. I will fix it.
> 
>     2017-03-01 0:27 GMT+01:00 Jan Michálek <
>     <mailto:>>:
> 
>         There it is, what i have.
>         I need i small help with psql.out, because \pset format wrapped.
>         I don`t know, how to have it in fixed width.
> 
>         2017-02-28 14:23 GMT+01:00 Jan Michálek <
>         <mailto:>>:
> 
>             Current state is something like this (diff is attached).
>             I currently haven`t regression test, tab completion etc., I
>             will add this thing following structure of asciidoc commit.
> 
>             Output is tested using retext, rst is OK, md have problem
>             with cells with newline (i must find out, how it is possible
>             create table with this in markdown).
> 
>             [jelen@laptak patch_postgre_rst]$
>             [jelen@laptak psql]$ ./psql
>             psql (9.6.2, server 9.6.1)
>             Type "help" for help.
> 
>             jelen=# \pset linestyle markdown
>             Line style is markdown.
>             jelen=# values(E'nasral Franta\nna trabanta','Žluťoučký
>             kobyly'), ('''',E'a\tb') \g | xclip
>             jelen=# values(E'nasral Franta\nna trabanta','Žluťoučký
>             kobyly'), ('''',E'a\tb') \g
> 
>             |    column1    |     column2      |
>             |---------------|------------------|
>             | nasral Franta | Žluťoučký kobyly |
>             | na trabanta   |                  |
>             | '             | a       b        |
> 
> 
>             (2 rows)
> 
>             jelen=# \pset linestyle rst
>             Line style is rst.
>             jelen=# values(E'nasral Franta\nna trabanta','Žluťoučký
>             kobyly'), ('''',E'a\tb') \g
>             +---------------+------------------+
>             |    column1    |     column2      |
>             +===============+==================+
>             | nasral Franta+| Žluťoučký kobyly |
>             | na trabanta   |                  |
>             +---------------+------------------+
>             | '             | a       b        |
>             +---------------+------------------+
> 
>             (2 rows)
> 
>             jelen=#
> 
>             2017-02-24 0:46 GMT+01:00 Michael Paquier
>             < <mailto:>>:
> 
>                 On Fri, Feb 24, 2017 at 3:09 AM, Jan Michálek
>                 <
>                 <mailto:>> wrote:
>                 > I can try it, doesn`t look dificult, but I`m worry, that I`m not able to
>                 > write clean, pretty code.
> 
>                 If you want to have something available in Postgres 10,
>                 you had better
>                 be quick. The last commit fest of the development cycle
>                 of Postgres 10
>                 begins on the 1st of March, you need to to register your
>                 patch here:
>                 https://commitfest.postgresql.org/13/
>                 <https://commitfest.postgresql.org/13/>
>                 Here are also some rough guidelines about submitting a
>                 patch:
>                 https://wiki.postgresql.org/wiki/Submitting_a_Patch
>                 <https://wiki.postgresql.org/wiki/Submitting_a_Patch>
>                 --
>                 Michael
> 
> 
> 
> 
>             -- 
>             Jelen
>             Starší čeledín datovýho chlíva
> 
> 
> 
> 
>         -- 
>         Jelen
>         Starší čeledín datovýho chlíva
> 
> 
> 
> 
>     -- 
>     Jelen
>     Starší čeledín datovýho chlíva
> 
> 
> 
> 
> -- 
> Jelen
> Starší čeledín datovýho chlíva
> 
> 
> 


-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



From:
Jan Michálek
Date:

I know, but, both new linestyles are created literally by cloning ascii linestyle and few lines in print_aligned_text. Both works with "aligned" and "wrapped" format. In rst is wrapped format useful, in my opinion, in markdown i can`t find how I can get newline in record (maybe it is not posiible in main markdown types). So it is why i add markdown and rst as new linestyles. But it is not problem to change it in command to use "\pset format", but i mean, that this is cleaner.

Je;


jelen=# \pset linestyle rst
Line style is rst.
jelen=# \pset format wrapped
Output format is wrapped.
jelen=# SELECT repeat('Goodnight Irene ', 30);
+-----------------------------------------------------------------------------+
|                                   repeat                                    |
+=============================================================================+
| Goodnight Irene Goodnight Irene Goodnight Irene Goodnight Irene Goodnight I.|
|.rene Goodnight Irene Goodnight Irene Goodnight Irene Goodnight Irene Goodni.|
|.ght Irene Goodnight Irene Goodnight Irene Goodnight Irene Goodnight Irene G.|
|.oodnight Irene Goodnight Irene Goodnight Irene Goodnight Irene Goodnight Ir.|
|.ene Goodnight Irene Goodnight Irene Goodnight Irene Goodnight Irene Goodnig.|
|.ht Irene Goodnight Irene Goodnight Irene Goodnight Irene Goodnight Irene Go.|
|.odnight Irene Goodnight Irene                                               |
+-----------------------------------------------------------------------------+

(1 row)

jelen=#



2017-03-01 15:00 GMT+01:00 Peter Eisentraut <peter.eisentraut@2ndquadrant.com>:
If you want to implement a new table format, you should be looking at
\pset format, not \pset linestyle.  \pset format sets different table
formats, such as html, latex, and asciidoc.  \pset linestyle just
chooses between different styles for the plain-text table format.

On 3/1/17 06:31, Jan Michálek wrote:
> Regression test corrected.
>
> 2017-03-01 11:43 GMT+01:00 Jan Michálek <
> <mailto:m>>:
>
>     Sorry, I have some errors in my diff, i had copy something from bad
>     folder. I will fix it.
>
>     2017-03-01 0:27 GMT+01:00 Jan Michálek <
>     <mailto:godzilalalala@gmail.com>>:
>
>         There it is, what i have.
>         I need i small help with psql.out, because \pset format wrapped.
>         I don`t know, how to have it in fixed width.
>
>         2017-02-28 14:23 GMT+01:00 Jan Michálek <
>         <mailto:godzilalalala@gmail.com>>:
>
>             Current state is something like this (diff is attached).
>             I currently haven`t regression test, tab completion etc., I
>             will add this thing following structure of asciidoc commit.
>
>             Output is tested using retext, rst is OK, md have problem
>             with cells with newline (i must find out, how it is possible
>             create table with this in markdown).
>
>             [jelen@laptak patch_postgre_rst]$
>             [jelen@laptak psql]$ ./psql
>             psql (9.6.2, server 9.6.1)
>             Type "help" for help.
>
>             jelen=# \pset linestyle markdown
>             Line style is markdown.
>             jelen=# values(E'nasral Franta\nna trabanta','Žluťoučký
>             kobyly'), ('''',E'a\tb') \g | xclip
>             jelen=# values(E'nasral Franta\nna trabanta','Žluťoučký
>             kobyly'), ('''',E'a\tb') \g
>
>             |    column1    |     column2      |
>             |---------------|------------------|
>             | nasral Franta | Žluťoučký kobyly |
>             | na trabanta   |                  |
>             | '             | a       b        |
>
>
>             (2 rows)
>
>             jelen=# \pset linestyle rst
>             Line style is rst.
>             jelen=# values(E'nasral Franta\nna trabanta','Žluťoučký
>             kobyly'), ('''',E'a\tb') \g
>             +---------------+------------------+
>             |    column1    |     column2      |
>             +===============+==================+
>             | nasral Franta+| Žluťoučký kobyly |
>             | na trabanta   |                  |
>             +---------------+------------------+
>             | '             | a       b        |
>             +---------------+------------------+
>
>             (2 rows)
>
>             jelen=#
>
>             2017-02-24 0:46 GMT+01:00 Michael Paquier
>             < <mailto:michael.paquier@gmail.com>>:
>
>                 On Fri, Feb 24, 2017 at 3:09 AM, Jan Michálek
>                 <
>                 <mailto:godzilalalala@gmail.com>> wrote:
>                 > I can try it, doesn`t look dificult, but I`m worry, that I`m not able to
>                 > write clean, pretty code.
>
>                 If you want to have something available in Postgres 10,
>                 you had better
>                 be quick. The last commit fest of the development cycle
>                 of Postgres 10
>                 begins on the 1st of March, you need to to register your
>                 patch here:
>                 https://commitfest.postgresql.org/13/
>                 <https://commitfest.postgresql.org/13/>
>                 Here are also some rough guidelines about submitting a
>                 patch:
>                 https://wiki.postgresql.org/wiki/Submitting_a_Patch
>                 <https://wiki.postgresql.org/wiki/Submitting_a_Patch>
>                 --
>                 Michael
>
>
>
>
>             --
>             Jelen
>             Starší čeledín datovýho chlíva
>
>
>
>
>         --
>         Jelen
>         Starší čeledín datovýho chlíva
>
>
>
>
>     --
>     Jelen
>     Starší čeledín datovýho chlíva
>
>
>
>
> --
> Jelen
> Starší čeledín datovýho chlíva
>
>
>


--
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



--
Jelen
Starší čeledín datovýho chlíva
From:
Pavel Stehule
Date:



2017-03-05 11:40 GMT+01:00 Jan Michálek <>:
I know, but, both new linestyles are created literally by cloning ascii linestyle and few lines in print_aligned_text. Both works with "aligned" and "wrapped" format. In rst is wrapped format useful, in my opinion, in markdown i can`t find how I can get newline in record (maybe it is not posiible in main markdown types). So it is why i add markdown and rst as new linestyles. But it is not problem to change it in command to use "\pset format", but i mean, that this is cleaner.

Using a special linestyle for new format is possible probably. But new format should be switched with \pset format command.

Not sure if wrapped or aligned behave is correct for markdown - it is task for markdown processing, not for psql.

Regards

Pavel

 

Je;


jelen=# \pset linestyle rst
Line style is rst.
jelen=# \pset format wrapped
Output format is wrapped.
jelen=# SELECT repeat('Goodnight Irene ', 30);
+-----------------------------------------------------------------------------+
|                                   repeat                                    |
+=============================================================================+
| Goodnight Irene Goodnight Irene Goodnight Irene Goodnight Irene Goodnight I.|
|.rene Goodnight Irene Goodnight Irene Goodnight Irene Goodnight Irene Goodni.|
|.ght Irene Goodnight Irene Goodnight Irene Goodnight Irene Goodnight Irene G.|
|.oodnight Irene Goodnight Irene Goodnight Irene Goodnight Irene Goodnight Ir.|
|.ene Goodnight Irene Goodnight Irene Goodnight Irene Goodnight Irene Goodnig.|
|.ht Irene Goodnight Irene Goodnight Irene Goodnight Irene Goodnight Irene Go.|
|.odnight Irene Goodnight Irene                                               |
+-----------------------------------------------------------------------------+

(1 row)

jelen=#



2017-03-01 15:00 GMT+01:00 Peter Eisentraut <peter.eisentraut@2ndquadrant.com>:
If you want to implement a new table format, you should be looking at
\pset format, not \pset linestyle.  \pset format sets different table
formats, such as html, latex, and asciidoc.  \pset linestyle just
chooses between different styles for the plain-text table format.

On 3/1/17 06:31, Jan Michálek wrote:
> Regression test corrected.
>
> 2017-03-01 11:43 GMT+01:00 Jan Michálek <
> <mailto:m>>:
>
>     Sorry, I have some errors in my diff, i had copy something from bad
>     folder. I will fix it.
>
>     2017-03-01 0:27 GMT+01:00 Jan Michálek <
>     <mailto:godzilalalala@gmail.com>>:
>
>         There it is, what i have.
>         I need i small help with psql.out, because \pset format wrapped.
>         I don`t know, how to have it in fixed width.
>
>         2017-02-28 14:23 GMT+01:00 Jan Michálek <
>         <mailto:godzilalalala@gmail.com>>:
>
>             Current state is something like this (diff is attached).
>             I currently haven`t regression test, tab completion etc., I
>             will add this thing following structure of asciidoc commit.
>
>             Output is tested using retext, rst is OK, md have problem
>             with cells with newline (i must find out, how it is possible
>             create table with this in markdown).
>
>             [jelen@laptak patch_postgre_rst]$
>             [jelen@laptak psql]$ ./psql
>             psql (9.6.2, server 9.6.1)
>             Type "help" for help.
>
>             jelen=# \pset linestyle markdown
>             Line style is markdown.
>             jelen=# values(E'nasral Franta\nna trabanta','Žluťoučký
>             kobyly'), ('''',E'a\tb') \g | xclip
>             jelen=# values(E'nasral Franta\nna trabanta','Žluťoučký
>             kobyly'), ('''',E'a\tb') \g
>
>             |    column1    |     column2      |
>             |---------------|------------------|
>             | nasral Franta | Žluťoučký kobyly |
>             | na trabanta   |                  |
>             | '             | a       b        |
>
>
>             (2 rows)
>
>             jelen=# \pset linestyle rst
>             Line style is rst.
>             jelen=# values(E'nasral Franta\nna trabanta','Žluťoučký
>             kobyly'), ('''',E'a\tb') \g
>             +---------------+------------------+
>             |    column1    |     column2      |
>             +===============+==================+
>             | nasral Franta+| Žluťoučký kobyly |
>             | na trabanta   |                  |
>             +---------------+------------------+
>             | '             | a       b        |
>             +---------------+------------------+
>
>             (2 rows)
>
>             jelen=#
>
>             2017-02-24 0:46 GMT+01:00 Michael Paquier
>             < <mailto:michael.paquier@gmail.com>>:
>
>                 On Fri, Feb 24, 2017 at 3:09 AM, Jan Michálek
>                 <
>                 <mailto:godzilalalala@gmail.com>> wrote:
>                 > I can try it, doesn`t look dificult, but I`m worry, that I`m not able to
>                 > write clean, pretty code.
>
>                 If you want to have something available in Postgres 10,
>                 you had better
>                 be quick. The last commit fest of the development cycle
>                 of Postgres 10
>                 begins on the 1st of March, you need to to register your
>                 patch here:
>                 https://commitfest.postgresql.org/13/
>                 <https://commitfest.postgresql.org/13/>
>                 Here are also some rough guidelines about submitting a
>                 patch:
>                 https://wiki.postgresql.org/wiki/Submitting_a_Patch
>                 <https://wiki.postgresql.org/wiki/Submitting_a_Patch>
>                 --
>                 Michael
>
>
>
>
>             --
>             Jelen
>             Starší čeledín datovýho chlíva
>
>
>
>
>         --
>         Jelen
>         Starší čeledín datovýho chlíva
>
>
>
>
>     --
>     Jelen
>     Starší čeledín datovýho chlíva
>
>
>
>
> --
> Jelen
> Starší čeledín datovýho chlíva
>
>
>


--
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



--
Jelen
Starší čeledín datovýho chlíva

From:
Jan Michálek
Date:

It is question if it is really new format, because formating is the same as aligned/wrapped format, changed is only style of lines.

2017-03-05 12:36 GMT+01:00 Pavel Stehule <>:


2017-03-05 11:40 GMT+01:00 Jan Michálek <>:
I know, but, both new linestyles are created literally by cloning ascii linestyle and few lines in print_aligned_text. Both works with "aligned" and "wrapped" format. In rst is wrapped format useful, in my opinion, in markdown i can`t find how I can get newline in record (maybe it is not posiible in main markdown types). So it is why i add markdown and rst as new linestyles. But it is not problem to change it in command to use "\pset format", but i mean, that this is cleaner.

Using a special linestyle for new format is possible probably. But new format should be switched with \pset format command.

Not sure if wrapped or aligned behave is correct for markdown - it is task for markdown processing, not for psql.

Regards

Pavel

 

Je;


jelen=# \pset linestyle rst
Line style is rst.
jelen=# \pset format wrapped
Output format is wrapped.
jelen=# SELECT repeat('Goodnight Irene ', 30);
+-----------------------------------------------------------------------------+
|                                   repeat                                    |
+=============================================================================+
| Goodnight Irene Goodnight Irene Goodnight Irene Goodnight Irene Goodnight I.|
|.rene Goodnight Irene Goodnight Irene Goodnight Irene Goodnight Irene Goodni.|
|.ght Irene Goodnight Irene Goodnight Irene Goodnight Irene Goodnight Irene G.|
|.oodnight Irene Goodnight Irene Goodnight Irene Goodnight Irene Goodnight Ir.|
|.ene Goodnight Irene Goodnight Irene Goodnight Irene Goodnight Irene Goodnig.|
|.ht Irene Goodnight Irene Goodnight Irene Goodnight Irene Goodnight Irene Go.|
|.odnight Irene Goodnight Irene                                               |
+-----------------------------------------------------------------------------+

(1 row)

jelen=#



2017-03-01 15:00 GMT+01:00 Peter Eisentraut <peter.eisentraut@2ndquadrant.com>:
If you want to implement a new table format, you should be looking at
\pset format, not \pset linestyle.  \pset format sets different table
formats, such as html, latex, and asciidoc.  \pset linestyle just
chooses between different styles for the plain-text table format.

On 3/1/17 06:31, Jan Michálek wrote:
> Regression test corrected.
>
> 2017-03-01 11:43 GMT+01:00 Jan Michálek <
> <mailto:m>>:
>
>     Sorry, I have some errors in my diff, i had copy something from bad
>     folder. I will fix it.
>
>     2017-03-01 0:27 GMT+01:00 Jan Michálek <
>     <mailto:godzilalalala@gmail.com>>:
>
>         There it is, what i have.
>         I need i small help with psql.out, because \pset format wrapped.
>         I don`t know, how to have it in fixed width.
>
>         2017-02-28 14:23 GMT+01:00 Jan Michálek <
>         <mailto:godzilalalala@gmail.com>>:
>
>             Current state is something like this (diff is attached).
>             I currently haven`t regression test, tab completion etc., I
>             will add this thing following structure of asciidoc commit.
>
>             Output is tested using retext, rst is OK, md have problem
>             with cells with newline (i must find out, how it is possible
>             create table with this in markdown).
>
>             [jelen@laptak patch_postgre_rst]$
>             [jelen@laptak psql]$ ./psql
>             psql (9.6.2, server 9.6.1)
>             Type "help" for help.
>
>             jelen=# \pset linestyle markdown
>             Line style is markdown.
>             jelen=# values(E'nasral Franta\nna trabanta','Žluťoučký
>             kobyly'), ('''',E'a\tb') \g | xclip
>             jelen=# values(E'nasral Franta\nna trabanta','Žluťoučký
>             kobyly'), ('''',E'a\tb') \g
>
>             |    column1    |     column2      |
>             |---------------|------------------|
>             | nasral Franta | Žluťoučký kobyly |
>             | na trabanta   |                  |
>             | '             | a       b        |
>
>
>             (2 rows)
>
>             jelen=# \pset linestyle rst
>             Line style is rst.
>             jelen=# values(E'nasral Franta\nna trabanta','Žluťoučký
>             kobyly'), ('''',E'a\tb') \g
>             +---------------+------------------+
>             |    column1    |     column2      |
>             +===============+==================+
>             | nasral Franta+| Žluťoučký kobyly |
>             | na trabanta   |                  |
>             +---------------+------------------+
>             | '             | a       b        |
>             +---------------+------------------+
>
>             (2 rows)
>
>             jelen=#
>
>             2017-02-24 0:46 GMT+01:00 Michael Paquier
>             < <mailto:michael.paquier@gmail.com>>:
>
>                 On Fri, Feb 24, 2017 at 3:09 AM, Jan Michálek
>                 <
>                 <mailto:godzilalalala@gmail.com>> wrote:
>                 > I can try it, doesn`t look dificult, but I`m worry, that I`m not able to
>                 > write clean, pretty code.
>
>                 If you want to have something available in Postgres 10,
>                 you had better
>                 be quick. The last commit fest of the development cycle
>                 of Postgres 10
>                 begins on the 1st of March, you need to to register your
>                 patch here:
>                 https://commitfest.postgresql.org/13/
>                 <https://commitfest.postgresql.org/13/>
>                 Here are also some rough guidelines about submitting a
>                 patch:
>                 https://wiki.postgresql.org/wiki/Submitting_a_Patch
>                 <https://wiki.postgresql.org/wiki/Submitting_a_Patch>
>                 --
>                 Michael
>
>
>
>
>             --
>             Jelen
>             Starší čeledín datovýho chlíva
>
>
>
>
>         --
>         Jelen
>         Starší čeledín datovýho chlíva
>
>
>
>
>     --
>     Jelen
>     Starší čeledín datovýho chlíva
>
>
>
>
> --
> Jelen
> Starší čeledín datovýho chlíva
>
>
>


--
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



--
Jelen
Starší čeledín datovýho chlíva




--
Jelen
Starší čeledín datovýho chlíva
From:
Pavel Stehule
Date:



2017-03-05 13:08 GMT+01:00 Jan Michálek <>:
It is question if it is really new format, because formating is the same as aligned/wrapped format, changed is only style of lines.


2017-03-05 12:36 GMT+01:00 Pavel Stehule <>:


2017-03-05 11:40 GMT+01:00 Jan Michálek <>:
I know, but, both new linestyles are created literally by cloning ascii linestyle and few lines in print_aligned_text. Both works with "aligned" and "wrapped" format. In rst is wrapped format useful, in my opinion, in markdown i can`t find how I can get newline in record (maybe it is not posiible in main markdown types). So it is why i add markdown and rst as new linestyles. But it is not problem to change it in command to use "\pset format", but i mean, that this is cleaner.

Using a special linestyle for new format is possible probably. But new format should be switched with \pset format command.

Not sure if wrapped or aligned behave is correct for markdown - it is task for markdown processing, not for psql.



In this case I am inclined to prefer setting via format setting - you can set a linestyle and border in one step, and then is easy to return back to previous format. I don't see a big benefit in enhancing set of ascii linestyles. The collecting new features in formatting is more intuitive (for me).


Regards

Pavel
 

Regards

Pavel

 

Je;


jelen=# \pset linestyle rst
Line style is rst.
jelen=# \pset format wrapped
Output format is wrapped.
jelen=# SELECT repeat('Goodnight Irene ', 30);
+-----------------------------------------------------------------------------+
|                                   repeat                                    |
+=============================================================================+
| Goodnight Irene Goodnight Irene Goodnight Irene Goodnight Irene Goodnight I.|
|.rene Goodnight Irene Goodnight Irene Goodnight Irene Goodnight Irene Goodni.|
|.ght Irene Goodnight Irene Goodnight Irene Goodnight Irene Goodnight Irene G.|
|.oodnight Irene Goodnight Irene Goodnight Irene Goodnight Irene Goodnight Ir.|
|.ene Goodnight Irene Goodnight Irene Goodnight Irene Goodnight Irene Goodnig.|
|.ht Irene Goodnight Irene Goodnight Irene Goodnight Irene Goodnight Irene Go.|
|.odnight Irene Goodnight Irene                                               |
+-----------------------------------------------------------------------------+

(1 row)

jelen=#



2017-03-01 15:00 GMT+01:00 Peter Eisentraut <peter.eisentraut@2ndquadrant.com>:
If you want to implement a new table format, you should be looking at
\pset format, not \pset linestyle.  \pset format sets different table
formats, such as html, latex, and asciidoc.  \pset linestyle just
chooses between different styles for the plain-text table format.

On 3/1/17 06:31, Jan Michálek wrote:
> Regression test corrected.
>
> 2017-03-01 11:43 GMT+01:00 Jan Michálek <
> <mailto:m>>:
>
>     Sorry, I have some errors in my diff, i had copy something from bad
>     folder. I will fix it.
>
>     2017-03-01 0:27 GMT+01:00 Jan Michálek <
>     <mailto:godzilalalala@gmail.com>>:
>
>         There it is, what i have.
>         I need i small help with psql.out, because \pset format wrapped.
>         I don`t know, how to have it in fixed width.
>
>         2017-02-28 14:23 GMT+01:00 Jan Michálek <
>         <mailto:godzilalalala@gmail.com>>:
>
>             Current state is something like this (diff is attached).
>             I currently haven`t regression test, tab completion etc., I
>             will add this thing following structure of asciidoc commit.
>
>             Output is tested using retext, rst is OK, md have problem
>             with cells with newline (i must find out, how it is possible
>             create table with this in markdown).
>
>             [jelen@laptak patch_postgre_rst]$
>             [jelen@laptak psql]$ ./psql
>             psql (9.6.2, server 9.6.1)
>             Type "help" for help.
>
>             jelen=# \pset linestyle markdown
>             Line style is markdown.
>             jelen=# values(E'nasral Franta\nna trabanta','Žluťoučký
>             kobyly'), ('''',E'a\tb') \g | xclip
>             jelen=# values(E'nasral Franta\nna trabanta','Žluťoučký
>             kobyly'), ('''',E'a\tb') \g
>
>             |    column1    |     column2      |
>             |---------------|------------------|
>             | nasral Franta | Žluťoučký kobyly |
>             | na trabanta   |                  |
>             | '             | a       b        |
>
>
>             (2 rows)
>
>             jelen=# \pset linestyle rst
>             Line style is rst.
>             jelen=# values(E'nasral Franta\nna trabanta','Žluťoučký
>             kobyly'), ('''',E'a\tb') \g
>             +---------------+------------------+
>             |    column1    |     column2      |
>             +===============+==================+
>             | nasral Franta+| Žluťoučký kobyly |
>             | na trabanta   |                  |
>             +---------------+------------------+
>             | '             | a       b        |
>             +---------------+------------------+
>
>             (2 rows)
>
>             jelen=#
>
>             2017-02-24 0:46 GMT+01:00 Michael Paquier
>             < <mailto:michael.paquier@gmail.com>>:
>
>                 On Fri, Feb 24, 2017 at 3:09 AM, Jan Michálek
>                 <
>                 <mailto:godzilalalala@gmail.com>> wrote:
>                 > I can try it, doesn`t look dificult, but I`m worry, that I`m not able to
>                 > write clean, pretty code.
>
>                 If you want to have something available in Postgres 10,
>                 you had better
>                 be quick. The last commit fest of the development cycle
>                 of Postgres 10
>                 begins on the 1st of March, you need to to register your
>                 patch here:
>                 https://commitfest.postgresql.org/13/
>                 <https://commitfest.postgresql.org/13/>
>                 Here are also some rough guidelines about submitting a
>                 patch:
>                 https://wiki.postgresql.org/wiki/Submitting_a_Patch
>                 <https://wiki.postgresql.org/wiki/Submitting_a_Patch>
>                 --
>                 Michael
>
>
>
>
>             --
>             Jelen
>             Starší čeledín datovýho chlíva
>
>
>
>
>         --
>         Jelen
>         Starší čeledín datovýho chlíva
>
>
>
>
>     --
>     Jelen
>     Starší čeledín datovýho chlíva
>
>
>
>
> --
> Jelen
> Starší čeledín datovýho chlíva
>
>
>


--
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



--
Jelen
Starší čeledín datovýho chlíva




--
Jelen
Starší čeledín datovýho chlíva

From:
Pavel Stehule
Date:



2017-03-05 13:22 GMT+01:00 Pavel Stehule <>:


2017-03-05 13:08 GMT+01:00 Jan Michálek <>:
It is question if it is really new format, because formating is the same as aligned/wrapped format, changed is only style of lines.


2017-03-05 12:36 GMT+01:00 Pavel Stehule <>:


2017-03-05 11:40 GMT+01:00 Jan Michálek <>:
I know, but, both new linestyles are created literally by cloning ascii linestyle and few lines in print_aligned_text. Both works with "aligned" and "wrapped" format. In rst is wrapped format useful, in my opinion, in markdown i can`t find how I can get newline in record (maybe it is not posiible in main markdown types). So it is why i add markdown and rst as new linestyles. But it is not problem to change it in command to use "\pset format", but i mean, that this is cleaner.

Using a special linestyle for new format is possible probably. But new format should be switched with \pset format command.

Not sure if wrapped or aligned behave is correct for markdown - it is task for markdown processing, not for psql.



In this case I am inclined to prefer setting via format setting - you can set a linestyle and border in one step, and then is easy to return back to previous format. I don't see a big benefit in enhancing set of ascii linestyles. The collecting new features in formatting is more intuitive (for me).

 This can be discussed what we prefer, and what we would to implement?



1. Nice formatted markdown tables


| Tables        | Are           | Cool  |
| ------------- |:-------------:| -----:|
| col 3 is      | right-aligned | $1600 |
| col 2 is      | centered      |   $12 |
| zebra stripes | are neat      |    $1 |
or 2. enough formatting

Markdown | Less | Pretty
--- | --- | ---
*Still* | `renders` | **nicely**
1 | 2 | 3

Pavel


From:
Jan Michálek
Date:



2017-03-05 13:39 GMT+01:00 Pavel Stehule <>:


2017-03-05 13:22 GMT+01:00 Pavel Stehule <>:


2017-03-05 13:08 GMT+01:00 Jan Michálek <>:
It is question if it is really new format, because formating is the same as aligned/wrapped format, changed is only style of lines.


2017-03-05 12:36 GMT+01:00 Pavel Stehule <>:


2017-03-05 11:40 GMT+01:00 Jan Michálek <>:
I know, but, both new linestyles are created literally by cloning ascii linestyle and few lines in print_aligned_text. Both works with "aligned" and "wrapped" format. In rst is wrapped format useful, in my opinion, in markdown i can`t find how I can get newline in record (maybe it is not posiible in main markdown types). So it is why i add markdown and rst as new linestyles. But it is not problem to change it in command to use "\pset format", but i mean, that this is cleaner.

Using a special linestyle for new format is possible probably. But new format should be switched with \pset format command.

Not sure if wrapped or aligned behave is correct for markdown - it is task for markdown processing, not for psql.



In this case I am inclined to prefer setting via format setting - you can set a linestyle and border in one step, and then is easy to return back to previous format. I don't see a big benefit in enhancing set of ascii linestyles. The collecting new features in formatting is more intuitive (for me).

 This can be discussed what we prefer, and what we would to implement?



1. Nice formatted markdown tables


| Tables        | Are           | Cool  |
| ------------- |:-------------:| -----:|
| col 3 is      | right-aligned | $1600 |
| col 2 is      | centered      |   $12 |
| zebra stripes | are neat      |    $1 |
or 2. enough formatting

Markdown | Less | Pretty
--- | --- | ---
*Still* | `renders` | **nicely**
1 | 2 | 3

I personally prefer nice formated table, because more comfortable reading source of document and easier editing with blocks (deleting whole columns etc.).
I will change \pset to format.
I find, when adding <\br> for newline works in retext. I will try to add it to patch.

| Tables | Are | Cool |

| ------------- |:-------------:| -----:|

| col 3 is | right-aligned | $1600 |

| col 2 is | centere<br/>d | $12 |

| zebra stripes | are neat | $1 |


Jan


 
Pavel





--
Jelen
Starší čeledín datovýho chlíva
From:
Jan Michálek
Date:



2017-03-05 14:02 GMT+01:00 Jan Michálek <>:


2017-03-05 13:39 GMT+01:00 Pavel Stehule <>:


2017-03-05 13:22 GMT+01:00 Pavel Stehule <>:


2017-03-05 13:08 GMT+01:00 Jan Michálek <>:
It is question if it is really new format, because formating is the same as aligned/wrapped format, changed is only style of lines.


2017-03-05 12:36 GMT+01:00 Pavel Stehule <>:


2017-03-05 11:40 GMT+01:00 Jan Michálek <>:
I know, but, both new linestyles are created literally by cloning ascii linestyle and few lines in print_aligned_text. Both works with "aligned" and "wrapped" format. In rst is wrapped format useful, in my opinion, in markdown i can`t find how I can get newline in record (maybe it is not posiible in main markdown types). So it is why i add markdown and rst as new linestyles. But it is not problem to change it in command to use "\pset format", but i mean, that this is cleaner.

Using a special linestyle for new format is possible probably. But new format should be switched with \pset format command.

changed

Not sure if wrapped or aligned behave is correct for markdown - it is task for markdown processing, not for psql.



In this case I am inclined to prefer setting via format setting - you can set a linestyle and border in one step, and then is easy to return back to previous format. I don't see a big benefit in enhancing set of ascii linestyles. The collecting new features in formatting is more intuitive (for me).

 This can be discussed what we prefer, and what we would to implement?



1. Nice formatted markdown tables


| Tables        | Are           | Cool  |
| ------------- |:-------------:| -----:|
| col 3 is      | right-aligned | $1600 |
| col 2 is      | centered      |   $12 |
| zebra stripes | are neat      |    $1 |
or 2. enough formatting

Markdown | Less | Pretty
--- | --- | ---
*Still* | `renders` | **nicely**
1 | 2 | 3

I personally prefer nice formated table, because more comfortable reading source of document and easier editing with blocks (deleting whole columns etc.).
I will change \pset to format.
I find, when adding <\br> for newline works in retext. I will try to add it to patch.

| Tables | Are | Cool |

| ------------- |:-------------:| -----:|

| col 3 is | right-aligned | $1600 |

| col 2 is | centere<br/>d | $12 |

| zebra stripes | are neat | $1 |


Jan


 
Pavel





--
Jelen
Starší čeledín datovýho chlíva



--
Jelen
Starší čeledín datovýho chlíva
From:
Jan Michálek
Date:


2017-03-06 16:25 GMT+01:00 Pavel Stehule <>:


2017-03-06 16:17 GMT+01:00 Jan Michálek <>:


2017-03-06 15:19 GMT+01:00 Pavel Stehule <>:


2017-03-06 0:26 GMT+01:00 Jan Michálek <>:


2017-03-05 14:02 GMT+01:00 Jan Michálek <>:


2017-03-05 13:39 GMT+01:00 Pavel Stehule <>:


2017-03-05 13:22 GMT+01:00 Pavel Stehule <>:


2017-03-05 13:08 GMT+01:00 Jan Michálek <>:
It is question if it is really new format, because formating is the same as aligned/wrapped format, changed is only style of lines.


2017-03-05 12:36 GMT+01:00 Pavel Stehule <>:


2017-03-05 11:40 GMT+01:00 Jan Michálek <>:
I know, but, both new linestyles are created literally by cloning ascii linestyle and few lines in print_aligned_text. Both works with "aligned" and "wrapped" format. In rst is wrapped format useful, in my opinion, in markdown i can`t find how I can get newline in record (maybe it is not posiible in main markdown types). So it is why i add markdown and rst as new linestyles. But it is not problem to change it in command to use "\pset format", but i mean, that this is cleaner.

Using a special linestyle for new format is possible probably. But new format should be switched with \pset format command.

changed

quick test shows it is working.

Just idea - can you specify aligning? right aligning for numbers, left for others?

I used "aligned" format as it is and I don`t know, if I`m able to do this with current solution based only on change linestyle internally.

you can try to test result in some markdown processors? I will not be surprised if these processor ignore aligning in input data.

I tested markdown only in retext and retext aligns columns set by -----:| well.

Refards

Pavel

 

Regards

Pavel




--
Jelen
Starší čeledín datovýho chlíva




--
Jelen
Starší čeledín datovýho chlíva
From:
Peter Eisentraut
Date:

On 3/5/17 05:40, Jan Michálek wrote:
> jelen=# \pset linestyle rst
> Line style is rst.
> jelen=# \pset format wrapped
> Output format is wrapped.
> jelen=# SELECT repeat('Goodnight Irene ', 30);
> +-----------------------------------------------------------------------------+
> |                                  
> repeat                                    |
> +=============================================================================+
> | Goodnight Irene Goodnight Irene Goodnight Irene Goodnight Irene
> Goodnight I.|
> |.rene Goodnight Irene Goodnight Irene Goodnight Irene Goodnight Irene
> Goodni.|
> |.ght Irene Goodnight Irene Goodnight Irene Goodnight Irene Goodnight
> Irene G.|

I doubt that this kind of line breaking style is actually proper rst.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



From:
Jan Michálek
Date:



2017-03-06 19:45 GMT+01:00 Peter Eisentraut <peter.eisentraut@2ndquadrant.com>:
On 3/5/17 05:40, Jan Michálek wrote:
> jelen=# \pset linestyle rst
> Line style is rst.
> jelen=# \pset format wrapped
> Output format is wrapped.
> jelen=# SELECT repeat('Goodnight Irene ', 30);
> +-----------------------------------------------------------------------------+
> |
> repeat                                    |
> +=============================================================================+
> | Goodnight Irene Goodnight Irene Goodnight Irene Goodnight Irene
> Goodnight I.|
> |.rene Goodnight Irene Goodnight Irene Goodnight Irene Goodnight Irene
> Goodni.|
> |.ght Irene Goodnight Irene Goodnight Irene Goodnight Irene Goodnight
> Irene G.|

I doubt that this kind of line breaking style is actually proper rst.

If you mean wrapped lines, it is wrapped by email client (in sent messages it looks as a table).
But really, this rst (original version from sent messages) doesn`t work (I actually test it) and don`t know why, but problem is probably related with linebreaks.
In last wersion of diff is pset changed from linestyle to format and using "wrapped" format is not possible.

Regards

Jan


--
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



--
Jelen
Starší čeledín datovýho chlíva
From:
Peter Eisentraut
Date:

This is looking pretty neat.  I played around with it a bit.  There are
a couple of edge cases that you need to address, I think.

- Does not support \x

- When \pset format is rst, then \pset linestyle also shows up as "rst".  That is wrong.  Same for markdown.

- Broken output in tuples_only (\t) mode. (rst and markdown)

- rst: Do something about \pset title; the way it currently shows up appears to be invalid; could use ".. table::
title"directive
 

- markdown: Extra blank line between table and footer.

- markdown: We should document or comment somewhere exactly which of the various markdown table formats this is
supposedto produce.  (Pandoc pipe_tables?)
 

- markdown: Table title needs to be after the table, like
   Table: title

- markdown: Needs to escape | characters in cell contents.  (Not needed for rst.)  More escaping might be needed.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



From:
Jan Michálek
Date:



2017-03-09 20:10 GMT+01:00 Peter Eisentraut <>:
This is looking pretty neat.  I played around with it a bit.  There are
a couple of edge cases that you need to address, I think.

Thanks, original code is very synoptical and and well prepared for adding new formats.
 

- Does not support \x

I know, i dnot`t know, if \x make sense in this case. I will look, how it is done in other formats like html. I think, that it should work in sense, that table generated to rst should give similar output after processing like output of html format.
 

- When \pset format is rst, then \pset linestyle also shows up as
  "rst".  That is wrong.  Same for markdown.

I will look on this.
 

- Broken output in tuples_only (\t) mode. (rst and markdown)

Similar to \x, im not certain, what it should return. I will look, what returns html format. Or i can use it in markdown for nice vs expanded format.
 

- rst: Do something about \pset title; the way it currently shows up
  appears to be invalid; could use ".. table:: title" directive

OK, it shouldn`t be problem alter this.
 

- markdown: Extra blank line between table and footer.

It is because markdown needs empty line after table, if is row count presented.
 

- markdown: We should document or comment somewhere exactly which of the
  various markdown table formats this is supposed to produce.  (Pandoc
  pipe_tables?)

I use format that was similar to aligned format and ascii linestyle, because it allows me to use existing features. I should look over more table styles in markdown.
 

- markdown: Table title needs to be after the table, like

    Table: title

I will change this.
 
- markdown: Needs to escape | characters in cell contents.  (Not
  needed for rst.)  More escaping might be needed.

This can be problem because of aligning, i will look on this, this same problem as replace newline with </br> for markdown.

Have Nice day

Jan
 

--
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



--
Jelen
Starší čeledín datovýho chlíva
From:
Jan Michálek
Date:

I find, there is problem in tab indent in rst, it looks that lines should be aligned to left in some cases.

2017-03-10 9:43 GMT+01:00 Jan Michálek <>:


2017-03-09 20:10 GMT+01:00 Peter Eisentraut <peter.eisentraut@2ndquadrant.com>:
This is looking pretty neat.  I played around with it a bit.  There are
a couple of edge cases that you need to address, I think.

Thanks, original code is very synoptical and and well prepared for adding new formats.
 

- Does not support \x

I know, i dnot`t know, if \x make sense in this case. I will look, how it is done in other formats like html. I think, that it should work in sense, that table generated to rst should give similar output after processing like output of html format.
 

- When \pset format is rst, then \pset linestyle also shows up as
  "rst".  That is wrong.  Same for markdown.

I will look on this.
 

- Broken output in tuples_only (\t) mode. (rst and markdown)

Similar to \x, im not certain, what it should return. I will look, what returns html format. Or i can use it in markdown for nice vs expanded format.
 

- rst: Do something about \pset title; the way it currently shows up
  appears to be invalid; could use ".. table:: title" directive

OK, it shouldn`t be problem alter this.
 

- markdown: Extra blank line between table and footer.

It is because markdown needs empty line after table, if is row count presented.
 

- markdown: We should document or comment somewhere exactly which of the
  various markdown table formats this is supposed to produce.  (Pandoc
  pipe_tables?)

I use format that was similar to aligned format and ascii linestyle, because it allows me to use existing features. I should look over more table styles in markdown.
 

- markdown: Table title needs to be after the table, like

    Table: title

I will change this.
 
- markdown: Needs to escape | characters in cell contents.  (Not
  needed for rst.)  More escaping might be needed.

This can be problem because of aligning, i will look on this, this same problem as replace newline with </br> for markdown.

Have Nice day

Jan
 

--
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



--
Jelen
Starší čeledín datovýho chlíva



--
Jelen
Starší čeledín datovýho chlíva
From:
Jan Michálek
Date:



2017-03-10 9:43 GMT+01:00 Jan Michálek <>:


2017-03-09 20:10 GMT+01:00 Peter Eisentraut <peter.eisentraut@2ndquadrant.com>:
This is looking pretty neat.  I played around with it a bit.  There are
a couple of edge cases that you need to address, I think.

Thanks, original code is very synoptical and and well prepared for adding new formats.
 

- Does not support \x

I know, i dnot`t know, if \x make sense in this case. I will look, how it is done in other formats like html. I think, that it should work in sense, that table generated to rst should give similar output after processing like output of html format.
 
I prepared something like this (i have no prepared diff, i need do some another changes)
There a few things I need to do. First problem is bold column names, i should do it in sme fashin as "RECORD", but i need to do some research about length of column.
Bigger problem is with tab indent, rst processor doesn`t work with this in this case.
 
jelen=# execute q \g | xclip
+---------+------------------------------------------------------------------------+
| **RECORD 1**                                                                     |
+---------+------------------------------------------------------------------------+
| column1 | Elephant, kangaroo,                                                    |
|         | squirrel, gorilla                                                      |
+---------+------------------------------------------------------------------------+
| column2 | 121                                                                    |
+---------+------------------------------------------------------------------------+
| column3 | 1.0035971223021583                                                     |
+---------+------------------------------------------------------------------------+
| column4 | 0.1111                                                                 |
+---------+------------------------------------------------------------------------+
| column5 | Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello            |
+---------+------------------------------------------------------------------------+
| **RECORD 2**                                                                     |
+---------+------------------------------------------------------------------------+
| column1 | goat, rhinoceros,                                                      |
|         | monkey, ape                                                            |
+---------+------------------------------------------------------------------------+
| column2 | 11121                                                                  |
+---------+------------------------------------------------------------------------+
| column3 | 1.0007824726134585                                                     |
+---------+------------------------------------------------------------------------+
| column4 | 5.1111                                                                 |
+---------+------------------------------------------------------------------------+
| column5 | xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx  |
+---------+------------------------------------------------------------------------+
| **RECORD 3**                                                                     |
+---------+------------------------------------------------------------------------+
| column1 | donkey, cow, horse, tit,                                               |
|         | eagle, whale,                                                          |
|         | aligator,                                                              |
|         |    pelican,                                                            |
|         | grasshoper                                                             |
|         | pig                                                                    |
|         |         bat                                                            |
+---------+------------------------------------------------------------------------+
| column2 | 14351                                                                  |
+---------+------------------------------------------------------------------------+
| column3 | 50.3877551020408163                                                    |
+---------+------------------------------------------------------------------------+
| column4 | 345.11                                                                 |
+---------+------------------------------------------------------------------------+
| column5 | yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy  |
+---------+------------------------------------------------------------------------+



 

- When \pset format is rst, then \pset linestyle also shows up as
  "rst".  That is wrong.  Same for markdown.

I will look on this.
 

- Broken output in tuples_only (\t) mode. (rst and markdown)

Similar to \x, im not certain, what it should return. I will look, what returns html format. Or i can use it in markdown for nice vs expanded format.
 

- rst: Do something about \pset title; the way it currently shows up
  appears to be invalid; could use ".. table:: title" directive

OK, it shouldn`t be problem alter this.
 

- markdown: Extra blank line between table and footer.

It is because markdown needs empty line after table, if is row count presented.
 

- markdown: We should document or comment somewhere exactly which of the
  various markdown table formats this is supposed to produce.  (Pandoc
  pipe_tables?)

I use format that was similar to aligned format and ascii linestyle, because it allows me to use existing features. I should look over more table styles in markdown.
 

- markdown: Table title needs to be after the table, like

    Table: title

I will change this.
 
- markdown: Needs to escape | characters in cell contents.  (Not
  needed for rst.)  More escaping might be needed.

This can be problem because of aligning, i will look on this, this same problem as replace newline with </br> for markdown.

Have Nice day

Jan
 

--
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



--
Jelen
Starší čeledín datovýho chlíva



--
Jelen
Starší čeledín datovýho chlíva
From:
Jan Michálek
Date:



2017-03-12 19:21 GMT+01:00 Jan Michálek <>:


2017-03-10 9:43 GMT+01:00 Jan Michálek <>:


2017-03-09 20:10 GMT+01:00 Peter Eisentraut <peter.eisentraut@2ndquadrant.com>:
This is looking pretty neat.  I played around with it a bit.  There are
a couple of edge cases that you need to address, I think.

Thanks, original code is very synoptical and and well prepared for adding new formats.
 

- Does not support \x

I know, i dnot`t know, if \x make sense in this case. I will look, how it is done in other formats like html. I think, that it should work in sense, that table generated to rst should give similar output after processing like output of html format.
 
I prepared something like this (i have no prepared diff, i need do some another changes)
There a few things I need to do. First problem is bold column names, i should do it in sme fashin as "RECORD", but i need to do some research about length of column.
Bigger problem is with tab indent, rst processor doesn`t work with this in this case.

In new diff is added \x for rst and skipping leading spaces in rst in both. make check passed

Jan
 
 
jelen=# execute q \g | xclip
+---------+------------------------------------------------------------------------+
| **RECORD 1**                                                                     |
+---------+------------------------------------------------------------------------+
| column1 | Elephant, kangaroo,                                                    |
|         | squirrel, gorilla                                                      |
+---------+------------------------------------------------------------------------+
| column2 | 121                                                                    |
+---------+------------------------------------------------------------------------+
| column3 | 1.0035971223021583                                                     |
+---------+------------------------------------------------------------------------+
| column4 | 0.1111                                                                 |
+---------+------------------------------------------------------------------------+
| column5 | Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello            |
+---------+------------------------------------------------------------------------+
| **RECORD 2**                                                                     |
+---------+------------------------------------------------------------------------+
| column1 | goat, rhinoceros,                                                      |
|         | monkey, ape                                                            |
+---------+------------------------------------------------------------------------+
| column2 | 11121                                                                  |
+---------+------------------------------------------------------------------------+
| column3 | 1.0007824726134585                                                     |
+---------+------------------------------------------------------------------------+
| column4 | 5.1111                                                                 |
+---------+------------------------------------------------------------------------+
| column5 | xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx  |
+---------+------------------------------------------------------------------------+
| **RECORD 3**                                                                     |
+---------+------------------------------------------------------------------------+
| column1 | donkey, cow, horse, tit,                                               |
|         | eagle, whale,                                                          |
|         | aligator,                                                              |
|         |    pelican,                                                            |
|         | grasshoper                                                             |
|         | pig                                                                    |
|         |         bat                                                            |
+---------+------------------------------------------------------------------------+
| column2 | 14351                                                                  |
+---------+------------------------------------------------------------------------+
| column3 | 50.3877551020408163                                                    |
+---------+------------------------------------------------------------------------+
| column4 | 345.11                                                                 |
+---------+------------------------------------------------------------------------+
| column5 | yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy  |
+---------+------------------------------------------------------------------------+



 

- When \pset format is rst, then \pset linestyle also shows up as
  "rst".  That is wrong.  Same for markdown.

I will look on this.
 

- Broken output in tuples_only (\t) mode. (rst and markdown)

Similar to \x, im not certain, what it should return. I will look, what returns html format. Or i can use it in markdown for nice vs expanded format.
 

- rst: Do something about \pset title; the way it currently shows up
  appears to be invalid; could use ".. table:: title" directive

OK, it shouldn`t be problem alter this.
 

- markdown: Extra blank line between table and footer.

It is because markdown needs empty line after table, if is row count presented.
 

- markdown: We should document or comment somewhere exactly which of the
  various markdown table formats this is supposed to produce.  (Pandoc
  pipe_tables?)

I use format that was similar to aligned format and ascii linestyle, because it allows me to use existing features. I should look over more table styles in markdown.
 

- markdown: Table title needs to be after the table, like

    Table: title

I will change this.
 
- markdown: Needs to escape | characters in cell contents.  (Not
  needed for rst.)  More escaping might be needed.

This can be problem because of aligning, i will look on this, this same problem as replace newline with </br> for markdown.

Have Nice day

Jan
 

--
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



--
Jelen
Starší čeledín datovýho chlíva



--
Jelen
Starší čeledín datovýho chlíva



--
Jelen
Starší čeledín datovýho chlíva
From:
"Ideriha, Takeshi"
Date:

Hi,

I like your suggestion and took a look at your patch though I’m not the expert about psql.

 

I like the idea taking advantage of linestyle utilities

to implement rst and markdown format efficiently instead of newly developing pset format things.

But I'm thinking two comments below needs change to something about not focusing only linestyle.

That's because they really take care of both '\pset linestyle and \pset format' and it may lead to misunderstanding to readers.

 

---

/* Line style control structures */

const printTextFormat pg_markdown =

 

/* get selected or default line style */

const printTextFormat *

get_line_style(const printTableOpt *opt)

---

 

The rest things are about code style convention.

- there are some indents with white spaces around skip_leading_spaces_print()

  but Postgresql conventions says indents should be with 4 column tab.

  https://www.postgresql.org/docs/devel/static/source-format.html

 

- On the other hand, in docs there are some tab indent

  but white space indenet is preferable. Looking around sgml files, white space is used.

 

- some multi-line comment style also needs fix according to the above documentation (link)

 

- And I also found patch cannot be applied to current master.

 

Regards,

Ideriha, Takeshi

 

From: [mailto:] On Behalf Of Jan Michalek
Sent: Sunday, March 19, 2017 5:10 AM
To: Peter Eisentraut <>
Cc: Pavel Stehule <>; PostgreSQL mailing lists <>
Subject: Re: [HACKERS] Other formats in pset like markdown, rst, mediawiki

 

 

 

2017-03-12 19:21 GMT+01:00 Jan Michálek <>:

 

 

2017-03-10 9:43 GMT+01:00 Jan Michálek <>:

 

 

2017-03-09 20:10 GMT+01:00 Peter Eisentraut <>:

This is looking pretty neat.  I played around with it a bit.  There are
a couple of edge cases that you need to address, I think.

 

Thanks, original code is very synoptical and and well prepared for adding new formats.

 


- Does not support \x

 

I know, i dnot`t know, if \x make sense in this case. I will look, how it is done in other formats like html. I think, that it should work in sense, that table generated to rst should give similar output after processing like output of html format.

 

I prepared something like this (i have no prepared diff, i need do some another changes)

There a few things I need to do. First problem is bold column names, i should do it in sme fashin as "RECORD", but i need to do some research about length of column.

Bigger problem is with tab indent, rst processor doesn`t work with this in this case.


In new diff is added \x for rst and skipping leading spaces in rst in both. make check passed

 

Jan

 

 

jelen=# execute q \g | xclip
+---------+------------------------------------------------------------------------+
| **RECORD 1**                                                                     |
+---------+------------------------------------------------------------------------+
| column1 | Elephant, kangaroo,                                                    |
|         | squirrel, gorilla                                                      |
+---------+------------------------------------------------------------------------+
| column2 | 121                                                                    |
+---------+------------------------------------------------------------------------+
| column3 | 1.0035971223021583                                                     |
+---------+------------------------------------------------------------------------+
| column4 | 0.1111                                                                 |
+---------+------------------------------------------------------------------------+
| column5 | Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello            |
+---------+------------------------------------------------------------------------+
| **RECORD 2**                                                                     |
+---------+------------------------------------------------------------------------+
| column1 | goat, rhinoceros,                                                      |
|         | monkey, ape                                                            |
+---------+------------------------------------------------------------------------+
| column2 | 11121                                                                  |
+---------+------------------------------------------------------------------------+
| column3 | 1.0007824726134585                                                     |
+---------+------------------------------------------------------------------------+
| column4 | 5.1111                                                                 |
+---------+------------------------------------------------------------------------+
| column5 | xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx  |
+---------+------------------------------------------------------------------------+
| **RECORD 3**                                                                     |
+---------+------------------------------------------------------------------------+
| column1 | donkey, cow, horse, tit,                                               |
|         | eagle, whale,                                                          |
|         | aligator,                                                              |
|         |    pelican,                                                            |
|         | grasshoper                                                             |
|         | pig                                                                    |
|         |         bat                                                            |
+---------+------------------------------------------------------------------------+
| column2 | 14351                                                                  |
+---------+------------------------------------------------------------------------+
| column3 | 50.3877551020408163                                                    |
+---------+------------------------------------------------------------------------+
| column4 | 345.11                                                                 |
+---------+------------------------------------------------------------------------+
| column5 | yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy  |
+---------+------------------------------------------------------------------------+



 


- When \pset format is rst, then \pset linestyle also shows up as
  "rst".  That is wrong.  Same for markdown.

 

I will look on this.

 


- Broken output in tuples_only (\t) mode. (rst and markdown)

 

Similar to \x, im not certain, what it should return. I will look, what returns html format. Or i can use it in markdown for nice vs expanded format.

 


- rst: Do something about \pset title; the way it currently shows up
  appears to be invalid; could use ".. table:: title" directive

 

OK, it shouldn`t be problem alter this.

 


- markdown: Extra blank line between table and footer.

 

It is because markdown needs empty line after table, if is row count presented.

 


- markdown: We should document or comment somewhere exactly which of the
  various markdown table formats this is supposed to produce.  (Pandoc
  pipe_tables?)

 

I use format that was similar to aligned format and ascii linestyle, because it allows me to use existing features. I should look over more table styles in markdown.

 


- markdown: Table title needs to be after the table, like

    Table: title

I will change this.

 

- markdown: Needs to escape | characters in cell contents.  (Not
  needed for rst.)  More escaping might be needed.

 

This can be problem because of aligning, i will look on this, this same problem as replace newline with </br> for markdown.

 

Have Nice day

Jan

 


--
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services




--

Jelen

Starší čeledín datovýho chlíva




--

Jelen

Starší čeledín datovýho chlíva




--

Jelen

Starší čeledín datovýho chlíva

From:
Pavel Stehule
Date:



2017-03-21 9:59 GMT+01:00 Ideriha, Takeshi <>:

Hi,

I like your suggestion and took a look at your patch though I’m not the expert about psql.

 

I like the idea taking advantage of linestyle utilities 

to implement rst and markdown format efficiently instead of newly developing pset format things.

But I'm thinking two comments below needs change to something about not focusing only linestyle.

That's because they really take care of both '\pset linestyle and \pset format' and it may lead to misunderstanding to readers.


I am not sure if linestyle is enough - the markdown aligning is not visual.

regards

Pavel 

 

---

/* Line style control structures */

const printTextFormat pg_markdown =

 

/* get selected or default line style */

const printTextFormat *

get_line_style(const printTableOpt *opt)

---

 

The rest things are about code style convention.

- there are some indents with white spaces around skip_leading_spaces_print()

  but Postgresql conventions says indents should be with 4 column tab.

  https://www.postgresql.org/docs/devel/static/source-format.html

 

- On the other hand, in docs there are some tab indent

  but white space indenet is preferable. Looking around sgml files, white space is used.

 

- some multi-line comment style also needs fix according to the above documentation (link)

 

- And I also found patch cannot be applied to current master.

 

Regards,

Ideriha, Takeshi

 

From: pgsql-hackers-owner@postgresql.org [mailto:pgsql-hackers-owner@postgresql.org] On Behalf Of Jan Michalek
Sent: Sunday, March 19, 2017 5:10 AM
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: Pavel Stehule <>; PostgreSQL mailing lists <>
Subject: Re: [HACKERS] Other formats in pset like markdown, rst, mediawiki

 

 

 

2017-03-12 19:21 GMT+01:00 Jan Michálek <>:

 

 

2017-03-10 9:43 GMT+01:00 Jan Michálek <>:

 

 

2017-03-09 20:10 GMT+01:00 Peter Eisentraut <peter.eisentraut@2ndquadrant.com>:

This is looking pretty neat.  I played around with it a bit.  There are
a couple of edge cases that you need to address, I think.

 

Thanks, original code is very synoptical and and well prepared for adding new formats.

 


- Does not support \x

 

I know, i dnot`t know, if \x make sense in this case. I will look, how it is done in other formats like html. I think, that it should work in sense, that table generated to rst should give similar output after processing like output of html format.

 

I prepared something like this (i have no prepared diff, i need do some another changes)

There a few things I need to do. First problem is bold column names, i should do it in sme fashin as "RECORD", but i need to do some research about length of column.

Bigger problem is with tab indent, rst processor doesn`t work with this in this case.


In new diff is added \x for rst and skipping leading spaces in rst in both. make check passed

 

Jan

 

 

jelen=# execute q \g | xclip
+---------+------------------------------------------------------------------------+
| **RECORD 1**                                                                     |
+---------+------------------------------------------------------------------------+
| column1 | Elephant, kangaroo,                                                    |
|         | squirrel, gorilla                                                      |
+---------+------------------------------------------------------------------------+
| column2 | 121                                                                    |
+---------+------------------------------------------------------------------------+
| column3 | 1.0035971223021583                                                     |
+---------+------------------------------------------------------------------------+
| column4 | 0.1111                                                                 |
+---------+------------------------------------------------------------------------+
| column5 | Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello            |
+---------+------------------------------------------------------------------------+
| **RECORD 2**                                                                     |
+---------+------------------------------------------------------------------------+
| column1 | goat, rhinoceros,                                                      |
|         | monkey, ape                                                            |
+---------+------------------------------------------------------------------------+
| column2 | 11121                                                                  |
+---------+------------------------------------------------------------------------+
| column3 | 1.0007824726134585                                                     |
+---------+------------------------------------------------------------------------+
| column4 | 5.1111                                                                 |
+---------+------------------------------------------------------------------------+
| column5 | xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx  |
+---------+------------------------------------------------------------------------+
| **RECORD 3**                                                                     |
+---------+------------------------------------------------------------------------+
| column1 | donkey, cow, horse, tit,                                               |
|         | eagle, whale,                                                          |
|         | aligator,                                                              |
|         |    pelican,                                                            |
|         | grasshoper                                                             |
|         | pig                                                                    |
|         |         bat                                                            |
+---------+------------------------------------------------------------------------+
| column2 | 14351                                                                  |
+---------+------------------------------------------------------------------------+
| column3 | 50.3877551020408163                                                    |
+---------+------------------------------------------------------------------------+
| column4 | 345.11                                                                 |
+---------+------------------------------------------------------------------------+
| column5 | yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy  |
+---------+------------------------------------------------------------------------+



 


- When \pset format is rst, then \pset linestyle also shows up as
  "rst".  That is wrong.  Same for markdown.

 

I will look on this.

 


- Broken output in tuples_only (\t) mode. (rst and markdown)

 

Similar to \x, im not certain, what it should return. I will look, what returns html format. Or i can use it in markdown for nice vs expanded format.

 


- rst: Do something about \pset title; the way it currently shows up
  appears to be invalid; could use ".. table:: title" directive

 

OK, it shouldn`t be problem alter this.

 


- markdown: Extra blank line between table and footer.

 

It is because markdown needs empty line after table, if is row count presented.

 


- markdown: We should document or comment somewhere exactly which of the
  various markdown table formats this is supposed to produce.  (Pandoc
  pipe_tables?)

 

I use format that was similar to aligned format and ascii linestyle, because it allows me to use existing features. I should look over more table styles in markdown.

 


- markdown: Table title needs to be after the table, like

    Table: title

I will change this.

 

- markdown: Needs to escape | characters in cell contents.  (Not
  needed for rst.)  More escaping might be needed.

 

This can be problem because of aligning, i will look on this, this same problem as replace newline with </br> for markdown.

 

Have Nice day

Jan

 


--
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services




--

Jelen

Starší čeledín datovýho chlíva




--

Jelen

Starší čeledín datovýho chlíva




--

Jelen

Starší čeledín datovýho chlíva


From:
Jan Michálek
Date:



2017-03-21 9:59 GMT+01:00 Ideriha, Takeshi <>:

Hi,

I like your suggestion and took a look at your patch though I’m not the expert about psql.

 

I like the idea taking advantage of linestyle utilities

to implement rst and markdown format efficiently instead of newly developing pset format things.

But I'm thinking two comments below needs change to something about not focusing only linestyle.

That's because they really take care of both '\pset linestyle and \pset format' and it may lead to misunderstanding to readers.

 

---

/* Line style control structures */

const printTextFormat pg_markdown =

 

/* get selected or default line style */

const printTextFormat *

get_line_style(const printTableOpt *opt)

---


It is in command.c?

I have it done that \pset format changes linestyle

psql (9.6.2, server 9.6.1)
Type "help" for help.

jelen=# \pset linestyle ascii
Line style is ascii.
jelen=# \pset format rst
Output format is rst.
jelen=# \pset linestyle
Line style is rst.
jelen=#

Peter wrote that this is not right, but i don`t know how it should like, because most of this is done on linestyle, format is used only for switch from console.

 

 

The rest things are about code style convention.

- there are some indents with white spaces around skip_leading_spaces_print()

  but Postgresql conventions says indents should be with 4 column tab.

  https://www.postgresql.org/docs/devel/static/source-format.html


Thanks, i often using 4 whitespaces (i have it in vim) but in other code i found mostly used 8 whitespaces.
I will look on this. I use code from another functions (fputnbytes, print_html_escaped) as template.
 

 

- On the other hand, in docs there are some tab indent

  but white space indenet is preferable. Looking around sgml files, white space is used.

 

- some multi-line comment style also needs fix according to the above documentation (link)


I will look on the comments, this is only work version, coding style issues will be corrected (i have some comments only my orientation in code).
 

 

- And I also found patch cannot be applied to current master.


I have 9.6.2 source code. It is not correct? Where i find source code i should use?

Have nice day
Jan
 

 

Regards,

Ideriha, Takeshi

 

From: pgsql-hackers-owner@postgresql.org [mailto:pgsql-hackers-owner@postgresql.org] On Behalf Of Jan Michalek
Sent: Sunday, March 19, 2017 5:10 AM
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: Pavel Stehule <>; PostgreSQL mailing lists <>
Subject: Re: [HACKERS] Other formats in pset like markdown, rst, mediawiki

 

 

 

2017-03-12 19:21 GMT+01:00 Jan Michálek <>:

 

 

2017-03-10 9:43 GMT+01:00 Jan Michálek <>:

 

 

2017-03-09 20:10 GMT+01:00 Peter Eisentraut <peter.eisentraut@2ndquadrant.com>:

This is looking pretty neat.  I played around with it a bit.  There are
a couple of edge cases that you need to address, I think.

 

Thanks, original code is very synoptical and and well prepared for adding new formats.

 


- Does not support \x

 

I know, i dnot`t know, if \x make sense in this case. I will look, how it is done in other formats like html. I think, that it should work in sense, that table generated to rst should give similar output after processing like output of html format.

 

I prepared something like this (i have no prepared diff, i need do some another changes)

There a few things I need to do. First problem is bold column names, i should do it in sme fashin as "RECORD", but i need to do some research about length of column.

Bigger problem is with tab indent, rst processor doesn`t work with this in this case.


In new diff is added \x for rst and skipping leading spaces in rst in both. make check passed

 

Jan

 

 

jelen=# execute q \g | xclip
+---------+------------------------------------------------------------------------+
| **RECORD 1**                                                                     |
+---------+------------------------------------------------------------------------+
| column1 | Elephant, kangaroo,                                                    |
|         | squirrel, gorilla                                                      |
+---------+------------------------------------------------------------------------+
| column2 | 121                                                                    |
+---------+------------------------------------------------------------------------+
| column3 | 1.0035971223021583                                                     |
+---------+------------------------------------------------------------------------+
| column4 | 0.1111                                                                 |
+---------+------------------------------------------------------------------------+
| column5 | Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello            |
+---------+------------------------------------------------------------------------+
| **RECORD 2**                                                                     |
+---------+------------------------------------------------------------------------+
| column1 | goat, rhinoceros,                                                      |
|         | monkey, ape                                                            |
+---------+------------------------------------------------------------------------+
| column2 | 11121                                                                  |
+---------+------------------------------------------------------------------------+
| column3 | 1.0007824726134585                                                     |
+---------+------------------------------------------------------------------------+
| column4 | 5.1111                                                                 |
+---------+------------------------------------------------------------------------+
| column5 | xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx  |
+---------+------------------------------------------------------------------------+
| **RECORD 3**                                                                     |
+---------+------------------------------------------------------------------------+
| column1 | donkey, cow, horse, tit,                                               |
|         | eagle, whale,                                                          |
|         | aligator,                                                              |
|         |    pelican,                                                            |
|         | grasshoper                                                             |
|         | pig                                                                    |
|         |         bat                                                            |
+---------+------------------------------------------------------------------------+
| column2 | 14351                                                                  |
+---------+------------------------------------------------------------------------+
| column3 | 50.3877551020408163                                                    |
+---------+------------------------------------------------------------------------+
| column4 | 345.11                                                                 |
+---------+------------------------------------------------------------------------+
| column5 | yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy  |
+---------+------------------------------------------------------------------------+



 


- When \pset format is rst, then \pset linestyle also shows up as
  "rst".  That is wrong.  Same for markdown.

 

I will look on this.

 


- Broken output in tuples_only (\t) mode. (rst and markdown)

 

Similar to \x, im not certain, what it should return. I will look, what returns html format. Or i can use it in markdown for nice vs expanded format.

 


- rst: Do something about \pset title; the way it currently shows up
  appears to be invalid; could use ".. table:: title" directive

 

OK, it shouldn`t be problem alter this.

 


- markdown: Extra blank line between table and footer.

 

It is because markdown needs empty line after table, if is row count presented.

 


- markdown: We should document or comment somewhere exactly which of the
  various markdown table formats this is supposed to produce.  (Pandoc
  pipe_tables?)

 

I use format that was similar to aligned format and ascii linestyle, because it allows me to use existing features. I should look over more table styles in markdown.

 


- markdown: Table title needs to be after the table, like

    Table: title

I will change this.

 

- markdown: Needs to escape | characters in cell contents.  (Not
  needed for rst.)  More escaping might be needed.

 

This can be problem because of aligning, i will look on this, this same problem as replace newline with </br> for markdown.

 

Have Nice day

Jan

 


--
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services




--

Jelen

Starší čeledín datovýho chlíva




--

Jelen

Starší čeledín datovýho chlíva




--

Jelen

Starší čeledín datovýho chlíva




--
Jelen
Starší čeledín datovýho chlíva
From:
Pavel Stehule
Date:



2017-03-21 10:59 GMT+01:00 Jan Michálek <>:


2017-03-21 9:59 GMT+01:00 Ideriha, Takeshi <.com>:

Hi,

I like your suggestion and took a look at your patch though I’m not the expert about psql.

 

I like the idea taking advantage of linestyle utilities

to implement rst and markdown format efficiently instead of newly developing pset format things.

But I'm thinking two comments below needs change to something about not focusing only linestyle.

That's because they really take care of both '\pset linestyle and \pset format' and it may lead to misunderstanding to readers.

 

---

/* Line style control structures */

const printTextFormat pg_markdown =

 

/* get selected or default line style */

const printTextFormat *

get_line_style(const printTableOpt *opt)

---


It is in command.c?

I have it done that \pset format changes linestyle

psql (9.6.2, server 9.6.1)
Type "help" for help.

jelen=# \pset linestyle ascii
Line style is ascii.
jelen=# \pset format rst
Output format is rst.
jelen=# \pset linestyle
Line style is rst.
jelen=#

Peter wrote that this is not right, but i don`t know how it should like, because most of this is done on linestyle, format is used only for switch from console.

 

 

The rest things are about code style convention.

- there are some indents with white spaces around skip_leading_spaces_print()

  but Postgresql conventions says indents should be with 4 column tab.

  https://www.postgresql.org/docs/devel/static/source-format.html


Thanks, i often using 4 whitespaces (i have it in vim) but in other code i found mostly used 8 whitespaces.
I will look on this. I use code from another functions (fputnbytes, print_html_escaped) as template.
 

 

- On the other hand, in docs there are some tab indent

  but white space indenet is preferable. Looking around sgml files, white space is used.

 

- some multi-line comment style also needs fix according to the above documentation (link)


I will look on the comments, this is only work version, coding style issues will be corrected (i have some comments only my orientation in code).
 

 

- And I also found patch cannot be applied to current master.


I have 9.6.2 source code. It is not correct? Where i find source code i should use?


Regards

Pavel

Have nice day
Jan
 

 

Regards,

Ideriha, Takeshi

 

From: pgsql-hackers-owner@postgresql.org [mailto:pgsql-hackers-owner@postgresql.org] On Behalf Of Jan Michalek
Sent: Sunday, March 19, 2017 5:10 AM
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: Pavel Stehule <>; PostgreSQL mailing lists <>
Subject: Re: [HACKERS] Other formats in pset like markdown, rst, mediawiki

 

 

 

2017-03-12 19:21 GMT+01:00 Jan Michálek <>:

 

 

2017-03-10 9:43 GMT+01:00 Jan Michálek <>:

 

 

2017-03-09 20:10 GMT+01:00 Peter Eisentraut <peter.eisentraut@2ndquadrant.com>:

This is looking pretty neat.  I played around with it a bit.  There are
a couple of edge cases that you need to address, I think.

 

Thanks, original code is very synoptical and and well prepared for adding new formats.

 


- Does not support \x

 

I know, i dnot`t know, if \x make sense in this case. I will look, how it is done in other formats like html. I think, that it should work in sense, that table generated to rst should give similar output after processing like output of html format.

 

I prepared something like this (i have no prepared diff, i need do some another changes)

There a few things I need to do. First problem is bold column names, i should do it in sme fashin as "RECORD", but i need to do some research about length of column.

Bigger problem is with tab indent, rst processor doesn`t work with this in this case.


In new diff is added \x for rst and skipping leading spaces in rst in both. make check passed

 

Jan

 

 

jelen=# execute q \g | xclip
+---------+------------------------------------------------------------------------+
| **RECORD 1**                                                                     |
+---------+------------------------------------------------------------------------+
| column1 | Elephant, kangaroo,                                                    |
|         | squirrel, gorilla                                                      |
+---------+------------------------------------------------------------------------+
| column2 | 121                                                                    |
+---------+------------------------------------------------------------------------+
| column3 | 1.0035971223021583                                                     |
+---------+------------------------------------------------------------------------+
| column4 | 0.1111                                                                 |
+---------+------------------------------------------------------------------------+
| column5 | Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello            |
+---------+------------------------------------------------------------------------+
| **RECORD 2**                                                                     |
+---------+------------------------------------------------------------------------+
| column1 | goat, rhinoceros,                                                      |
|         | monkey, ape                                                            |
+---------+------------------------------------------------------------------------+
| column2 | 11121                                                                  |
+---------+------------------------------------------------------------------------+
| column3 | 1.0007824726134585                                                     |
+---------+------------------------------------------------------------------------+
| column4 | 5.1111                                                                 |
+---------+------------------------------------------------------------------------+
| column5 | xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx  |
+---------+------------------------------------------------------------------------+
| **RECORD 3**                                                                     |
+---------+------------------------------------------------------------------------+
| column1 | donkey, cow, horse, tit,                                               |
|         | eagle, whale,                                                          |
|         | aligator,                                                              |
|         |    pelican,                                                            |
|         | grasshoper                                                             |
|         | pig                                                                    |
|         |         bat                                                            |
+---------+------------------------------------------------------------------------+
| column2 | 14351                                                                  |
+---------+------------------------------------------------------------------------+
| column3 | 50.3877551020408163                                                    |
+---------+------------------------------------------------------------------------+
| column4 | 345.11                                                                 |
+---------+------------------------------------------------------------------------+
| column5 | yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy  |
+---------+------------------------------------------------------------------------+



 


- When \pset format is rst, then \pset linestyle also shows up as
  "rst".  That is wrong.  Same for markdown.

 

I will look on this.

 


- Broken output in tuples_only (\t) mode. (rst and markdown)

 

Similar to \x, im not certain, what it should return. I will look, what returns html format. Or i can use it in markdown for nice vs expanded format.

 


- rst: Do something about \pset title; the way it currently shows up
  appears to be invalid; could use ".. table:: title" directive

 

OK, it shouldn`t be problem alter this.

 


- markdown: Extra blank line between table and footer.

 

It is because markdown needs empty line after table, if is row count presented.

 


- markdown: We should document or comment somewhere exactly which of the
  various markdown table formats this is supposed to produce.  (Pandoc
  pipe_tables?)

 

I use format that was similar to aligned format and ascii linestyle, because it allows me to use existing features. I should look over more table styles in markdown.

 


- markdown: Table title needs to be after the table, like

    Table: title

I will change this.

 

- markdown: Needs to escape | characters in cell contents.  (Not
  needed for rst.)  More escaping might be needed.

 

This can be problem because of aligning, i will look on this, this same problem as replace newline with </br> for markdown.

 

Have Nice day

Jan

 


--
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services




--

Jelen

Starší čeledín datovýho chlíva




--

Jelen

Starší čeledín datovýho chlíva




--

Jelen

Starší čeledín datovýho chlíva




--
Jelen
Starší čeledín datovýho chlíva

From:
Jan Michálek
Date:



2017-03-21 11:01 GMT+01:00 Pavel Stehule <>:


2017-03-21 10:59 GMT+01:00 Jan Michálek <>:


2017-03-21 9:59 GMT+01:00 Ideriha, Takeshi <m>:

Hi,

I like your suggestion and took a look at your patch though I’m not the expert about psql.

 

I like the idea taking advantage of linestyle utilities

to implement rst and markdown format efficiently instead of newly developing pset format things.

But I'm thinking two comments below needs change to something about not focusing only linestyle.

That's because they really take care of both '\pset linestyle and \pset format' and it may lead to misunderstanding to readers.

 

---

/* Line style control structures */

const printTextFormat pg_markdown =

 

/* get selected or default line style */

const printTextFormat *

get_line_style(const printTableOpt *opt)

---


It is in command.c?

I have it done that \pset format changes linestyle

psql (9.6.2, server 9.6.1)
Type "help" for help.

jelen=# \pset linestyle ascii
Line style is ascii.
jelen=# \pset format rst
Output format is rst.
jelen=# \pset linestyle
Line style is rst.
jelen=#

Peter wrote that this is not right, but i don`t know how it should like, because most of this is done on linestyle, format is used only for switch from console.

 

 

The rest things are about code style convention.

- there are some indents with white spaces around skip_leading_spaces_print()

  but Postgresql conventions says indents should be with 4 column tab.

  https://www.postgresql.org/docs/devel/static/source-format.html


Thanks, i often using 4 whitespaces (i have it in vim) but in other code i found mostly used 8 whitespaces.
I will look on this. I use code from another functions (fputnbytes, print_html_escaped) as template.
 

 

- On the other hand, in docs there are some tab indent

  but white space indenet is preferable. Looking around sgml files, white space is used.

 

- some multi-line comment style also needs fix according to the above documentation (link)


I will look on the comments, this is only work version, coding style issues will be corrected (i have some comments only my orientation in code).
 

 

- And I also found patch cannot be applied to current master.


I have 9.6.2 source code. It is not correct? Where i find source code i should use?


Thanks, i will look on this on weekend.

 
Regards

Pavel

Have nice day
Jan
 

 

Regards,

Ideriha, Takeshi

 

From: pgsql-hackers-owner@postgresql.org [mailto:pgsql-hackers-owner@postgresql.org] On Behalf Of Jan Michalek
Sent: Sunday, March 19, 2017 5:10 AM
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: Pavel Stehule <>; PostgreSQL mailing lists <>
Subject: Re: [HACKERS] Other formats in pset like markdown, rst, mediawiki

 

 

 

2017-03-12 19:21 GMT+01:00 Jan Michálek <>:

 

 

2017-03-10 9:43 GMT+01:00 Jan Michálek <>:

 

 

2017-03-09 20:10 GMT+01:00 Peter Eisentraut <peter.eisentraut@2ndquadrant.com>:

This is looking pretty neat.  I played around with it a bit.  There are
a couple of edge cases that you need to address, I think.

 

Thanks, original code is very synoptical and and well prepared for adding new formats.

 


- Does not support \x

 

I know, i dnot`t know, if \x make sense in this case. I will look, how it is done in other formats like html. I think, that it should work in sense, that table generated to rst should give similar output after processing like output of html format.

 

I prepared something like this (i have no prepared diff, i need do some another changes)

There a few things I need to do. First problem is bold column names, i should do it in sme fashin as "RECORD", but i need to do some research about length of column.

Bigger problem is with tab indent, rst processor doesn`t work with this in this case.


In new diff is added \x for rst and skipping leading spaces in rst in both. make check passed

 

Jan

 

 

jelen=# execute q \g | xclip
+---------+------------------------------------------------------------------------+
| **RECORD 1**                                                                     |
+---------+------------------------------------------------------------------------+
| column1 | Elephant, kangaroo,                                                    |
|         | squirrel, gorilla                                                      |
+---------+------------------------------------------------------------------------+
| column2 | 121                                                                    |
+---------+------------------------------------------------------------------------+
| column3 | 1.0035971223021583                                                     |
+---------+------------------------------------------------------------------------+
| column4 | 0.1111                                                                 |
+---------+------------------------------------------------------------------------+
| column5 | Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello            |
+---------+------------------------------------------------------------------------+
| **RECORD 2**                                                                     |
+---------+------------------------------------------------------------------------+
| column1 | goat, rhinoceros,                                                      |
|         | monkey, ape                                                            |
+---------+------------------------------------------------------------------------+
| column2 | 11121                                                                  |
+---------+------------------------------------------------------------------------+
| column3 | 1.0007824726134585                                                     |
+---------+------------------------------------------------------------------------+
| column4 | 5.1111                                                                 |
+---------+------------------------------------------------------------------------+
| column5 | xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx  |
+---------+------------------------------------------------------------------------+
| **RECORD 3**                                                                     |
+---------+------------------------------------------------------------------------+
| column1 | donkey, cow, horse, tit,                                               |
|         | eagle, whale,                                                          |
|         | aligator,                                                              |
|         |    pelican,                                                            |
|         | grasshoper                                                             |
|         | pig                                                                    |
|         |         bat                                                            |
+---------+------------------------------------------------------------------------+
| column2 | 14351                                                                  |
+---------+------------------------------------------------------------------------+
| column3 | 50.3877551020408163                                                    |
+---------+------------------------------------------------------------------------+
| column4 | 345.11                                                                 |
+---------+------------------------------------------------------------------------+
| column5 | yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy  |
+---------+------------------------------------------------------------------------+



 


- When \pset format is rst, then \pset linestyle also shows up as
  "rst".  That is wrong.  Same for markdown.

 

I will look on this.

 


- Broken output in tuples_only (\t) mode. (rst and markdown)

 

Similar to \x, im not certain, what it should return. I will look, what returns html format. Or i can use it in markdown for nice vs expanded format.

 


- rst: Do something about \pset title; the way it currently shows up
  appears to be invalid; could use ".. table:: title" directive

 

OK, it shouldn`t be problem alter this.

 


- markdown: Extra blank line between table and footer.

 

It is because markdown needs empty line after table, if is row count presented.

 


- markdown: We should document or comment somewhere exactly which of the
  various markdown table formats this is supposed to produce.  (Pandoc
  pipe_tables?)

 

I use format that was similar to aligned format and ascii linestyle, because it allows me to use existing features. I should look over more table styles in markdown.

 


- markdown: Table title needs to be after the table, like

    Table: title

I will change this.

 

- markdown: Needs to escape | characters in cell contents.  (Not
  needed for rst.)  More escaping might be needed.

 

This can be problem because of aligning, i will look on this, this same problem as replace newline with </br> for markdown.

 

Have Nice day

Jan

 


--
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services




--

Jelen

Starší čeledín datovýho chlíva




--

Jelen

Starší čeledín datovýho chlíva




--

Jelen

Starší čeledín datovýho chlíva




--
Jelen
Starší čeledín datovýho chlíva




--
Jelen
Starší čeledín datovýho chlíva
From:
"Ideriha, Takeshi"
Date:

>>I like the idea taking advantage of linestyle utilities 
>>to implement rst and markdown format efficiently instead of newly developing pset format things.
>>But I'm thinking two comments below needs change to something about not focusing only linestyle. 
>>That's because they really take care of both '\pset linestyle and \pset format' and it may lead to misunderstanding
toreaders.
 
>> 
>>---
>>/* Line style control structures */
>>const printTextFormat pg_markdown =
>> 
>>/* get selected or default line style */
>>const printTextFormat *
>>get_line_style(const printTableOpt *opt)
>>---

>It is in command.c?
>I have it done that \pset format changes linestyle


>psql (9.6.2, server 9.6.1)
>Type "help" for help.

>jelen=# \pset linestyle ascii
>Line style is ascii.
>jelen=# \pset format rst
>Output format is rst.
>jelen=# \pset linestyle
>Line style is rst.
>jelen=# 
>Peter wrote that this is not right, but i don`t know how it should like, because most of this is done on linestyle,
formatis used only for switch from console.
 

Thank you for explanation!

That's about print.c, but my explanation was poor...
My point was a slight thing about comments in source code.
I've just wanted to say comments needs change to match actual code.
These comments says about line style but the corresponding codes are about both line style and format. 

But these points should be considered after how to implement the new formats are decided.
So please don't care.
(I've just thought implementing the new formats using linestyle code came into consensus.)

Regards, 
Ideriha Takeshi

From:
Pierre Ducroquet
Date:

The following review has been posted through the commitfest application:
make installcheck-world:  tested, passed
Implements feature:       tested, passed
Spec compliant:           tested, passed
Documentation:            tested, passed

Hi

This is my first review (Magnus said in his presentation in PGDay Paris that volunteers should just come and help, so
hereI am), so please notify me for any mistake I do when using the review tools...
 

The feature seems to work as expected, but I don't claim to be a markdown and rst expert.
Some minor issues with the code itself :
- some indentation issues (documentation and code itself with mix between space based and tab based indentation) and a
fewtrailing spaces in code
 
- typographic issues in the documentation :  - "The html, asciidoc, latex, latex-longtable, troff-ms, and markdown and
rstformats" ==> duplicated and - "Sets the output format to one of unaligned, aligned, wrapped, html, asciidoc, latex
(usestabular), latex-longtable, rst, markdown, or troff-ms." ==> extra comma at the end of the list
 
- the comment " dont add line after last row, because line is added after every row" is misleading, it should warn that
it'sonly for rst
 
- there is a block of commented out code left
- in the print_aligned_vertical function, there is a mix between "cont->opt->format == PRINT_RST" and "format ==
&pg_rst"and I don't see any obvious reason for that
 
- the documentation doesn't mention (but ok, it's kind of obvious) that the linestyle option will not work with rst and
markdown

Thanks !

The new status of this patch is: Waiting on Author

From:
Jan Michálek
Date:



2017-03-23 17:26 GMT+01:00 Pierre Ducroquet <>:
The following review has been posted through the commitfest application:
make installcheck-world:  tested, passed
Implements feature:       tested, passed
Spec compliant:           tested, passed
Documentation:            tested, passed

Hi

This is my first review (Magnus said in his presentation in PGDay Paris that volunteers should just come and help, so here I am), so please notify me for any mistake I do when using the review tools...

The feature seems to work as expected, but I don't claim to be a markdown and rst expert.
Some minor issues with the code itself :
- some indentation issues (documentation and code itself with mix between space based and tab based indentation) and a few trailing spaces in code
- typographic issues in the documentation :
  - "The html, asciidoc, latex, latex-longtable, troff-ms, and markdown and rst formats" ==> duplicated and
  - "Sets the output format to one of unaligned, aligned, wrapped, html, asciidoc, latex (uses tabular), latex-longtable, rst, markdown, or troff-ms." ==> extra comma at the end of the list
- the comment " dont add line after last row, because line is added after every row" is misleading, it should warn that it's only for rst
- there is a block of commented out code left
- in the print_aligned_vertical function, there is a mix between "cont->opt->format == PRINT_RST" and "format == &pg_rst" and I don't see any obvious reason for that
- the documentation doesn't mention (but ok, it's kind of obvious) that the linestyle option will not work with rst and markdown

Thanks !

Thanks
I will work on it this weekend. I need to adapt it to current master and i will do some indentation issues with this.
I need to add \x to markdown format and some things about title from older posts there.

Nice Day Je;

 

The new status of this patch is: Waiting on Author

--
Sent via pgsql-hackers mailing list ()
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



--
Jelen
Starší čeledín datovýho chlíva
From:
Jan Michálek
Date:



2017-03-23 17:26 GMT+01:00 Pierre Ducroquet <>:
The following review has been posted through the commitfest application:
make installcheck-world:  tested, passed
Implements feature:       tested, passed
Spec compliant:           tested, passed
Documentation:            tested, passed

Hi

This is my first review (Magnus said in his presentation in PGDay Paris that volunteers should just come and help, so here I am), so please notify me for any mistake I do when using the review tools...

The feature seems to work as expected, but I don't claim to be a markdown and rst expert.
Some minor issues with the code itself :
- some indentation issues (documentation and code itself with mix between space based and tab based indentation) and a few trailing spaces in code

corrected
 
- typographic issues in the documentation :
  - "The html, asciidoc, latex, latex-longtable, troff-ms, and markdown and rst formats" ==> duplicated and

corrected
  - "Sets the output format to one of unaligned, aligned, wrapped, html, asciidoc, latex (uses tabular), latex-longtable, rst, markdown, or troff-ms." ==> extra comma at the end of the list
- the comment " dont add line after last row, because line is added after every row" is misleading, it should warn that it's only for rst
- there is a block of commented out code left
- in the print_aligned_vertical function, there is a mix between "cont->opt->format == PRINT_RST" and "format == &pg_rst" and I don't see any obvious reason for that
corrected
- the documentation doesn't mention (but ok, it's kind of obvious) that the linestyle option will not work with rst and markdown


In this patch are corrected (i hope, i had correct changes in vimrc) indentation issues. Plese, look at this if it is OK (i men indentats) and some minor errors. And it should work on current master (probably).

Have nice day

Jan
 
Thanks !

The new status of this patch is: Waiting on Author

--
Sent via pgsql-hackers mailing list ()
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



--
Jelen
Starší čeledín datovýho chlíva
From:
Jan Michálek
Date:



2017-03-27 19:41 GMT+02:00 Jan Michálek <>:


2017-03-23 17:26 GMT+01:00 Pierre Ducroquet <>:
The following review has been posted through the commitfest application:
make installcheck-world:  tested, passed
Implements feature:       tested, passed
Spec compliant:           tested, passed
Documentation:            tested, passed

Hi

This is my first review (Magnus said in his presentation in PGDay Paris that volunteers should just come and help, so here I am), so please notify me for any mistake I do when using the review tools...

The feature seems to work as expected, but I don't claim to be a markdown and rst expert.
Some minor issues with the code itself :
- some indentation issues (documentation and code itself with mix between space based and tab based indentation) and a few trailing spaces in code

corrected
 
- typographic issues in the documentation :
  - "The html, asciidoc, latex, latex-longtable, troff-ms, and markdown and rst formats" ==> duplicated and

corrected
  - "Sets the output format to one of unaligned, aligned, wrapped, html, asciidoc, latex (uses tabular), latex-longtable, rst, markdown, or troff-ms." ==> extra comma at the end of the list
- the comment " dont add line after last row, because line is added after every row" is misleading, it should warn that it's only for rst
- there is a block of commented out code left
- in the print_aligned_vertical function, there is a mix between "cont->opt->format == PRINT_RST" and "format == &pg_rst" and I don't see any obvious reason for that
corrected
- the documentation doesn't mention (but ok, it's kind of obvious) that the linestyle option will not work with rst and markdown


In this patch are corrected (i hope, i had correct changes in vimrc) indentation issues. Plese, look at this if it is OK (i men indentats) and some minor errors. And it should work on current master (probably).

Added \x option form markdown
In markdown works multiline cels (newline replaced by </br>)
regre tests passed

Jan

 

Have nice day

Jan
 
Thanks !

The new status of this patch is: Waiting on Author

--
Sent via pgsql-hackers mailing list ()
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



--
Jelen
Starší čeledín datovýho chlíva



--
Jelen
Starší čeledín datovýho chlíva
From:
Pavel Stehule
Date:



2017-03-29 20:11 GMT+02:00 Jan Michálek <>:


2017-03-27 19:41 GMT+02:00 Jan Michálek <>:


2017-03-23 17:26 GMT+01:00 Pierre Ducroquet <>:
The following review has been posted through the commitfest application:
make installcheck-world:  tested, passed
Implements feature:       tested, passed
Spec compliant:           tested, passed
Documentation:            tested, passed

Hi

This is my first review (Magnus said in his presentation in PGDay Paris that volunteers should just come and help, so here I am), so please notify me for any mistake I do when using the review tools...

The feature seems to work as expected, but I don't claim to be a markdown and rst expert.
Some minor issues with the code itself :
- some indentation issues (documentation and code itself with mix between space based and tab based indentation) and a few trailing spaces in code

corrected
 
- typographic issues in the documentation :
  - "The html, asciidoc, latex, latex-longtable, troff-ms, and markdown and rst formats" ==> duplicated and

corrected
  - "Sets the output format to one of unaligned, aligned, wrapped, html, asciidoc, latex (uses tabular), latex-longtable, rst, markdown, or troff-ms." ==> extra comma at the end of the list
- the comment " dont add line after last row, because line is added after every row" is misleading, it should warn that it's only for rst
- there is a block of commented out code left
- in the print_aligned_vertical function, there is a mix between "cont->opt->format == PRINT_RST" and "format == &pg_rst" and I don't see any obvious reason for that
corrected
- the documentation doesn't mention (but ok, it's kind of obvious) that the linestyle option will not work with rst and markdown


In this patch are corrected (i hope, i had correct changes in vimrc) indentation issues. Plese, look at this if it is OK (i men indentats) and some minor errors. And it should work on current master (probably).

Added \x option form markdown
In markdown works multiline cels (newline replaced by </br>)
regre tests passed

\pset format rst
\x
select 10
crash on segfault

Program received signal SIGSEGV, Segmentation fault.
0x00007f77673a866c in vfprintf () from /lib64/libc.so.6
(gdb) bt
#0  0x00007f77673a866c in vfprintf () from /lib64/libc.so.6
#1  0x00007f77673b1574 in fprintf () from /lib64/libc.so.6
#2  0x0000000000437bc5 in print_aligned_vertical (cont=0x7fffade43da0, fout=<optimized out>, 
    is_pager=<optimized out>) at print.c:1755
#3  0x000000000043a70d in printTable (cont=cont@entry=0x7fffade43da0, fout=<optimized out>, 
    fout@entry=0x7f77677255e0 <_IO_2_1_stdout_>, is_pager=<optimized out>, is_pager@entry=0 '\000', 
    flog=flog@entry=0x0) at print.c:3466
#4  0x000000000043c37f in printQuery (result=result@entry=0x9c4b60, opt=opt@entry=0x7fffade43f00, 
    fout=0x7f77677255e0 <_IO_2_1_stdout_>, is_pager=is_pager@entry=0 '\000', flog=0x0) at print.c:3551
#5  0x000000000040da6d in PrintQueryTuples (results=0x9c4b60) at common.c:808
#6  PrintQueryResults (results=0x9c4b60) at common.c:1140
#7  SendQuery (query=0x9c1700 "select 10;") at common.c:1317
#8  0x000000000041c3d4 in MainLoop (source=0x7f77677248a0 <_IO_2_1_stdin_>) at mainloop.c:319
#9  0x0000000000405d5d in main (argc=<optimized out>, argv=<optimized out>) at startup.c:396

Regards

Pavel
 


Jan

 

Have nice day

Jan
 
Thanks !

The new status of this patch is: Waiting on Author

--
Sent via pgsql-hackers mailing list ()
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



--
Jelen
Starší čeledín datovýho chlíva



--
Jelen
Starší čeledín datovýho chlíva


--
Sent via pgsql-hackers mailing list ()
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


From:
Jan Michálek
Date:



2017-03-30 21:53 GMT+02:00 Pavel Stehule <>:


2017-03-29 20:11 GMT+02:00 Jan Michálek <>:


2017-03-27 19:41 GMT+02:00 Jan Michálek <>:


2017-03-23 17:26 GMT+01:00 Pierre Ducroquet <>:
The following review has been posted through the commitfest application:
make installcheck-world:  tested, passed
Implements feature:       tested, passed
Spec compliant:           tested, passed
Documentation:            tested, passed

Hi

This is my first review (Magnus said in his presentation in PGDay Paris that volunteers should just come and help, so here I am), so please notify me for any mistake I do when using the review tools...

The feature seems to work as expected, but I don't claim to be a markdown and rst expert.
Some minor issues with the code itself :
- some indentation issues (documentation and code itself with mix between space based and tab based indentation) and a few trailing spaces in code

corrected
 
- typographic issues in the documentation :
  - "The html, asciidoc, latex, latex-longtable, troff-ms, and markdown and rst formats" ==> duplicated and

corrected
  - "Sets the output format to one of unaligned, aligned, wrapped, html, asciidoc, latex (uses tabular), latex-longtable, rst, markdown, or troff-ms." ==> extra comma at the end of the list
- the comment " dont add line after last row, because line is added after every row" is misleading, it should warn that it's only for rst
- there is a block of commented out code left
- in the print_aligned_vertical function, there is a mix between "cont->opt->format == PRINT_RST" and "format == &pg_rst" and I don't see any obvious reason for that
corrected
- the documentation doesn't mention (but ok, it's kind of obvious) that the linestyle option will not work with rst and markdown


In this patch are corrected (i hope, i had correct changes in vimrc) indentation issues. Plese, look at this if it is OK (i men indentats) and some minor errors. And it should work on current master (probably).

Added \x option form markdown
In markdown works multiline cels (newline replaced by </br>)
regre tests passed

\pset format rst
\x
select 10
crash on segfault

Program received signal SIGSEGV, Segmentation fault.
0x00007f77673a866c in vfprintf () from /lib64/libc.so.6
(gdb) bt
#0  0x00007f77673a866c in vfprintf () from /lib64/libc.so.6
#1  0x00007f77673b1574 in fprintf () from /lib64/libc.so.6
#2  0x0000000000437bc5 in print_aligned_vertical (cont=0x7fffade43da0, fout=<optimized out>, 
    is_pager=<optimized out>) at print.c:1755
#3  0x000000000043a70d in printTable (cont=cont@entry=0x7fffade43da0, fout=<optimized out>, 
    fout@entry=0x7f77677255e0 <_IO_2_1_stdout_>, is_pager=<optimized out>, is_pager@entry=0 '\000', 
    flog=flog@entry=0x0) at print.c:3466
#4  0x000000000043c37f in printQuery (result=result@entry=0x9c4b60, opt=opt@entry=0x7fffade43f00, 
    fout=0x7f77677255e0 <_IO_2_1_stdout_>, is_pager=is_pager@entry=0 '\000', flog=0x0) at print.c:3551
#5  0x000000000040da6d in PrintQueryTuples (results=0x9c4b60) at common.c:808
#6  PrintQueryResults (results=0x9c4b60) at common.c:1140
#7  SendQuery (query=0x9c1700 "select 10;") at common.c:1317
#8  0x000000000041c3d4 in MainLoop (source=0x7f77677248a0 <_IO_2_1_stdin_>) at mainloop.c:319
#9  0x0000000000405d5d in main (argc=<optimized out>, argv=<optimized out>) at startup.c:396

Regards

On source from monday it works (last commit on master I have is from 27.3 14:30). Or, maybe I didn`t generate diff well, or some gitt issue.

psql (10devel, server 9.6.1)
Type "help" for help.

jelen=# \x
Expanded display is on.
jelen=# \pset format rst
Output format is rst.
jelen=# select 10;
+--------------+----+
| **RECORD 1**      |
+--------------+----+
| **?column?** | 10 |
+--------------+----+

jelen=#

 

Pavel
 


Jan

 

Have nice day

Jan
 
Thanks !

The new status of this patch is: Waiting on Author

--
Sent via pgsql-hackers mailing list ()
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



--
Jelen
Starší čeledín datovýho chlíva



--
Jelen
Starší čeledín datovýho chlíva


--
Sent via pgsql-hackers mailing list ()
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers





--
Jelen
Starší čeledín datovýho chlíva
From:
Pierre Ducroquet
Date:

On Friday, March 31, 2017 7:17:08 AM CEST, Jan Michálek wrote:
>
>
> 2017-03-30 21:53 GMT+02:00 Pavel Stehule <>:
>
>
> 2017-03-29 20:11 GMT+02:00 Jan Michálek <>:
>
>
> 2017-03-27 19:41 GMT+02:00 Jan Michálek <>:
>
>
> 2017-03-23 17:26 GMT+01:00 Pierre Ducroquet <>:
> The following review has been posted through the commitfest application:
> make installcheck-world:  tested, passed
> Implements feature:       tested, passed
> Spec compliant:           tested, passed
> Documentation:            tested, passed
>
> Hi
>
> This is my first review (Magnus said in his presentation in
> PGDay Paris that volunteers should just come and help, so here I
> am), so please notify me for any mistake I do when using the
> review tools...
>
> The feature seems to work as expected, but I don't claim to be
> a markdown and rst expert.
> Some minor issues with the code itself :
> - some indentation issues (documentation and code itself with
> mix between space based and tab based indentation) and a few
> trailing spaces in code
>
> corrected
>
> - typographic issues in the documentation :
>   - "The html, asciidoc, latex, latex-longtable, troff-ms, and
> markdown and rst formats" ==> duplicated and
>
> corrected
>   - "Sets the output format to one of unaligned, aligned,
> wrapped, html, asciidoc, latex (uses tabular), latex-longtable,
> rst, markdown, or troff-ms." ==> extra comma at the end of the
> list
> - the comment " dont add line after last row, because line is
> added after every row" is misleading, it should warn that it's
> only for rst
> - there is a block of commented out code left
> - in the print_aligned_vertical function, there is a mix
> between "cont->opt->format == PRINT_RST" and "format == &pg_rst"
> and I don't see any obvious reason for that
> corrected
> - the documentation doesn't mention (but ok, it's kind of
> obvious) that the linestyle option will not work with rst and
> markdown
>
>
> In this patch are corrected (i hope, i had correct changes in
> vimrc) indentation issues. Plese, look at this if it is OK (i
> men indentats) and some minor errors. And it should work on
> current master (probably).
>
> Added \x option form markdown
> In markdown works multiline cels (newline replaced by </br>)
> regre tests passed
>
> \pset format rst
> \x
> select 10
> crash on segfault
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x00007f77673a866c in vfprintf () from /lib64/libc.so.6
> (gdb) bt
> #0  0x00007f77673a866c in vfprintf () from /lib64/libc.so.6
> #1  0x00007f77673b1574 in fprintf () from /lib64/libc.so.6
> #2  0x0000000000437bc5 in print_aligned_vertical
> (cont=0x7fffade43da0, fout=<optimized out>,
>     is_pager=<optimized out>) at print.c:1755
> #3  0x000000000043a70d in printTable
> (cont=cont@entry=0x7fffade43da0, fout=<optimized out>,
>     fout@entry=0x7f77677255e0 <_IO_2_1_stdout_>,
> is_pager=<optimized out>, is_pager@entry=0 '\000',
>     flog=flog@entry=0x0) at print.c:3466
> #4  0x000000000043c37f in printQuery
> (result=result@entry=0x9c4b60, opt=opt@entry=0x7fffade43f00,
>     fout=0x7f77677255e0 <_IO_2_1_stdout_>,
> is_pager=is_pager@entry=0 '\000', flog=0x0) at print.c:3551
> #5  0x000000000040da6d in PrintQueryTuples (results=0x9c4b60)
> at common.c:808
> #6  PrintQueryResults (results=0x9c4b60) at common.c:1140
> #7  SendQuery (query=0x9c1700 "select 10;") at common.c:1317
> #8  0x000000000041c3d4 in MainLoop (source=0x7f77677248a0
> <_IO_2_1_stdin_>) at mainloop.c:319
> #9  0x0000000000405d5d in main (argc=<optimized out>,
> argv=<optimized out>) at startup.c:396
>
> Regards
>
> On source from monday it works (last commit on master I have is
> from 27.3 14:30). Or, maybe I didn`t generate diff well, or some
> gitt issue.

I agree with Pavel, there is a segfault when you do these with your current
patch. The current patch does not pass make check-world.
How did you generate the diff ? Basically, the simplest way to generate a
patch serie is through git format-patch.
For instance, say you have a rstFormat branch freshly rebased upon
origin/master, just do git format-patch origin/master..rstFormat and you
will
have one patch file per commit.
And don't forget to commit everything :)

I hope this helps, I don't have enough time to go through the patch and
find
out what is causing the segfault right now.



From:
Jan Michálek
Date:



2017-03-31 12:01 GMT+02:00 Pierre Ducroquet <>:
On Friday, March 31, 2017 7:17:08 AM CEST, Jan Michálek wrote:


2017-03-30 21:53 GMT+02:00 Pavel Stehule <>:


2017-03-29 20:11 GMT+02:00 Jan Michálek <>:


2017-03-27 19:41 GMT+02:00 Jan Michálek <>:


2017-03-23 17:26 GMT+01:00 Pierre Ducroquet <>:
The following review has been posted through the commitfest application:
make installcheck-world:  tested, passed
Implements feature:       tested, passed
Spec compliant:           tested, passed
Documentation:            tested, passed

Hi

This is my first review (Magnus said in his presentation in PGDay Paris that volunteers should just come and help, so here I am), so please notify me for any mistake I do when using the review tools...

The feature seems to work as expected, but I don't claim to be a markdown and rst expert.
Some minor issues with the code itself :
- some indentation issues (documentation and code itself with mix between space based and tab based indentation) and a few trailing spaces in code

corrected
 - typographic issues in the documentation :
  - "The html, asciidoc, latex, latex-longtable, troff-ms, and markdown and rst formats" ==> duplicated and

corrected   - "Sets the output format to one of unaligned, aligned, wrapped, html, asciidoc, latex (uses tabular), latex-longtable, rst, markdown, or troff-ms." ==> extra comma at the end of the list
- the comment " dont add line after last row, because line is added after every row" is misleading, it should warn that it's only for rst
- there is a block of commented out code left
- in the print_aligned_vertical function, there is a mix between "cont->opt->format == PRINT_RST" and "format == &pg_rst" and I don't see any obvious reason for that
corrected - the documentation doesn't mention (but ok, it's kind of obvious) that the linestyle option will not work with rst and markdown


In this patch are corrected (i hope, i had correct changes in vimrc) indentation issues. Plese, look at this if it is OK (i men indentats) and some minor errors. And it should work on current master (probably).

Added \x option form markdown
In markdown works multiline cels (newline replaced by </br>)
regre tests passed

\pset format rst
\x
select 10
crash on segfault

Program received signal SIGSEGV, Segmentation fault.
0x00007f77673a866c in vfprintf () from /lib64/libc.so.6
(gdb) bt
#0  0x00007f77673a866c in vfprintf () from /lib64/libc.so.6
#1  0x00007f77673b1574 in fprintf () from /lib64/libc.so.6
#2  0x0000000000437bc5 in print_aligned_vertical (cont=0x7fffade43da0, fout=<optimized out>,     is_pager=<optimized out>) at print.c:1755
#3  0x000000000043a70d in printTable (cont=cont@entry=0x7fffade43da0, fout=<optimized out>,     fout@entry=0x7f77677255e0 <_IO_2_1_stdout_>, is_pager=<optimized out>, is_pager@entry=0 '\000',     flog=flog@entry=0x0) at print.c:3466
#4  0x000000000043c37f in printQuery (result=result@entry=0x9c4b60, opt=opt@entry=0x7fffade43f00,     fout=0x7f77677255e0 <_IO_2_1_stdout_>, is_pager=is_pager@entry=0 '\000', flog=0x0) at print.c:3551
#5  0x000000000040da6d in PrintQueryTuples (results=0x9c4b60) at common.c:808
#6  PrintQueryResults (results=0x9c4b60) at common.c:1140
#7  SendQuery (query=0x9c1700 "select 10;") at common.c:1317
#8  0x000000000041c3d4 in MainLoop (source=0x7f77677248a0 <_IO_2_1_stdin_>) at mainloop.c:319
#9  0x0000000000405d5d in main (argc=<optimized out>, argv=<optimized out>) at startup.c:396

Regards

On source from monday it works (last commit on master I have is from 27.3 14:30). Or, maybe I didn`t generate diff well, or some gitt issue.

I agree with Pavel, there is a segfault when you do these with your current patch. The current patch does not pass make check-world.
How did you generate the diff ? Basically, the simplest way to generate a patch serie is through git format-patch.
For instance, say you have a rstFormat branch freshly rebased upon origin/master, just do git format-patch origin/master..rstFormat and you will have one patch file per commit.
And don't forget to commit everything :)

I hope this helps, I don't have enough time to go through the patch and find out what is causing the segfault right now.

There was error in code (I don`t know why it works on my computer). Pavel found this error and there is corrected patch.

Thanks

Jan

P.S.: There are few things i should change (linestyle comment, few things in documentation, table annotation etc), so I didn`t change state of patch.



--
Jelen
Starší čeledín datovýho chlíva
From:
Jan Michálek
Date:



2017-03-23 17:26 GMT+01:00 Pierre Ducroquet <>:
The following review has been posted through the commitfest application:
make installcheck-world:  tested, passed
Implements feature:       tested, passed
Spec compliant:           tested, passed
Documentation:            tested, passed

Hi

This is my first review (Magnus said in his presentation in PGDay Paris that volunteers should just come and help, so here I am), so please notify me for any mistake I do when using the review tools...

The feature seems to work as expected, but I don't claim to be a markdown and rst expert.
Some minor issues with the code itself :
- some indentation issues (documentation and code itself with mix between space based and tab based indentation) and a few trailing spaces in code
- typographic issues in the documentation :
  - "The html, asciidoc, latex, latex-longtable, troff-ms, and markdown and rst formats" ==> duplicated and
  - "Sets the output format to one of unaligned, aligned, wrapped, html, asciidoc, latex (uses tabular), latex-longtable, rst, markdown, or troff-ms." ==> extra comma at the end of the list
- the comment " dont add line after last row, because line is added after every row" is misleading, it should warn that it's only for rst
- there is a block of commented out code left
- in the print_aligned_vertical function, there is a mix between "cont->opt->format == PRINT_RST" and "format == &pg_rst" and I don't see any obvious reason for that
- the documentation doesn't mention (but ok, it's kind of obvious) that the linestyle option will not work with rst and markdown

Thanks !

The new status of this patch is: Waiting on Author

Corrected problem with \pset linestyle when format is set to markdown, or rst.

Corrected tuples only for markdown and rst (normal and expanded)

Jan

 

--
Sent via pgsql-hackers mailing list ()
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



--
Jelen
Starší čeledín datovýho chlíva
From:
Andres Freund
Date:

Hi,

On 2017-04-02 22:28:40 +0200, Jan Michálek wrote:
> 2017-03-23 17:26 GMT+01:00 Pierre Ducroquet <>:
> > The new status of this patch is: Waiting on Author
> >
> 
> Corrected problem with \pset linestyle when format is set to markdown, or
> rst.
> 
> Corrected tuples only for markdown and rst (normal and expanded)

This patch still is undergoing development and review, and the code
freeze is closing in rapidly.  As this patch has been submitted just
before the last commitfest in the v10 cycle and has received plenty
feedback, I think it's fair to move this to the next commitfest.

Regards,

Andres



From:
Jan Michálek
Date:



2017-04-06 0:55 GMT+02:00 Andres Freund <>:
Hi,

On 2017-04-02 22:28:40 +0200, Jan Michálek wrote:
> 2017-03-23 17:26 GMT+01:00 Pierre Ducroquet <>:
> > The new status of this patch is: Waiting on Author
> >
>
> Corrected problem with \pset linestyle when format is set to markdown, or
> rst.
>
> Corrected tuples only for markdown and rst (normal and expanded)

This patch still is undergoing development and review, and the code
freeze is closing in rapidly.  As this patch has been submitted just
before the last commitfest in the v10 cycle and has received plenty
feedback, I think it's fair to move this to the next commitfest.

Regards,

Andres
There is only few last things to complete (align by |:- in markdown and pset title, and few words about pabdoc pipe tables in documentation).
I hope, I`m able to do this on sunday, or monday.

Jan


--
Jelen
Starší čeledín datovýho chlíva
From:
Andres Freund
Date:


On April 5, 2017 11:19:04 PM PDT, "Jan Michálek" <> wrote:
>2017-04-06 0:55 GMT+02:00 Andres Freund <>:
>
>> Hi,
>>
>> On 2017-04-02 22:28:40 +0200, Jan Michálek wrote:
>> > 2017-03-23 17:26 GMT+01:00 Pierre Ducroquet <>:
>> > > The new status of this patch is: Waiting on Author
>> > >
>> >
>> > Corrected problem with \pset linestyle when format is set to
>markdown, or
>> > rst.
>> >
>> > Corrected tuples only for markdown and rst (normal and expanded)
>>
>> This patch still is undergoing development and review, and the code
>> freeze is closing in rapidly.  As this patch has been submitted just
>> before the last commitfest in the v10 cycle and has received plenty
>> feedback, I think it's fair to move this to the next commitfest.
>>
>> Regards,
>>
>> Andres
>>
>There is only few last things to complete (align by |:- in markdown and
>pset title, and few words about pabdoc pipe tables in documentation).
>I hope, I`m able to do this on sunday, or monday.

Code freeze is on Friday.  As this patch is still in active development, I don't think it's realistic to get this into
v10.

Andres

--
Sent from my Android device with K-9 Mail. Please excuse my brevity.



From:
Fabien COELHO
Date:

Hello Jan,

> Corrected problem with \pset linestyle when format is set to markdown, or
> rst.
>
> Corrected tuples only for markdown and rst (normal and expanded)

It seems that the patch does not apply anymore on head due to changes in 
psql non regression tests. Could you rebase?

-- 
Fabien.



From:
Jan Michálek
Date:



2017-04-18 2:27 GMT+02:00 Fabien COELHO <>:

Hello Jan,

Corrected problem with \pset linestyle when format is set to markdown, or
rst.

Corrected tuples only for markdown and rst (normal and expanded)

It seems that the patch does not apply anymore on head due to changes in psql non regression tests. Could you rebase?

Hi
This patch willl not be in 10, because i haven`t it already completed on commit freeze.

Should I update it to current master? Im afraid, that some changes will be in conflict with this.

Je;

 

--
Fabien.



--
Jelen
Starší čeledín datovýho chlíva
From:
Jan Michálek
Date:



2017-04-18 2:27 GMT+02:00 Fabien COELHO <>:

Hello Jan,

Corrected problem with \pset linestyle when format is set to markdown, or
rst.

Corrected tuples only for markdown and rst (normal and expanded)

It seems that the patch does not apply anymore on head due to changes in psql non regression tests. Could you rebase?

This should work on current master (all test passed).

Je;
 

--
Fabien.



--
Jelen
Starší čeledín datovýho chlíva
From:
Fabien COELHO
Date:

Hello Jan,

>> It seems that the patch does not apply anymore on head due to changes in
>> psql non regression tests. Could you rebase?
>
> This should work on current master (all test passed).

Patch applies, compiles and make check is ok.

There are different flavour of markdown, maybe you should document which 
one is targetted. Should it be CommonMark? Another variant? Why?

ISTM that the md format lacks escaping for special md characters:
 fabien=# SELECT E'\\n\n</br>' AS foo; │     foo      │ |--------------| │ \n</br></br>

I'd say that you need to do escaping more or less similar to html?

Also, it seems that you use distinct vertical bar characters in the 
format? Or is this a trick of my terminal?? It seems that your patch 
introduces U+2502 (BOX DRAWINGS LIGHT VERTICAL) instead of the usual pipe 
in some places. Maybe you copy-pasted things from the unicode linestyle.

Why are *_newline variants added for length and formatting? Would it be 
possible to do without, say by relying on the line count computed by the 
standard function for instance?

The help line is too long, I would suggest not to add the new formats, 
the list is already truncated with "..." for other formats.

In the sgml documentation, you introduce tab characters, where only spaces 
should be used.

pg_markdown contains a spurious space between a comma and a newline.

-- 
Fabien.

From:
Jan Michálek
Date:



2017-04-18 12:06 GMT+02:00 Fabien COELHO <>:

Hello Jan,

It seems that the patch does not apply anymore on head due to changes in
psql non regression tests. Could you rebase?

This should work on current master (all test passed).

Patch applies, compiles and make check is ok.

There are different flavour of markdown, maybe you should document which one is targetted. Should it be CommonMark? Another variant? Why?

This should be pandoc pipe table. It's because it is similar to aligned format. I need add this to documentation (i have it in recent TODO)
 

ISTM that the md format lacks escaping for special md characters:

 fabien=# SELECT E'\\n\n</br>' AS foo;
 │     foo      │
 |--------------|
 │ \n</br></br>

I'd say that you need to do escaping more or less similar to html?

There is problem with markown and newlines. Replacing newline by br was only solution that I was able to find.

Also, it seems that you use distinct vertical bar characters in the format? Or is this a trick of my terminal?? It seems that your patch introduces U+2502 (BOX DRAWINGS LIGHT VERTICAL) instead of the usual pipe in some places. Maybe you copy-pasted things from the unicode linestyle.

Main of the functionality is used from aligned format. I tested returned tables in retext and it works. If i have another character than standart pipe, it shouldn`t work.
 

Why are *_newline variants added for length and formatting? Would it be possible to do without, say by relying on the line count computed by the standard function for instance?

It`s because newlines in markdown, If I need to do it without copy this function, i had to add parameter for markdown to this functions.
 

The help line is too long, I would suggest not to add the new formats, the list is already truncated with "..." for other formats.

OK
 

In the sgml documentation, you introduce tab characters, where only spaces should be used.

OK, I modified vimrc as it is in documentation, maybe i do something wrong. I will correct this.
 

pg_markdown obsahuje falešný prostor mezi čárkou a nový řádek.

I will look on this.
 

--
Fabien.



--
Jelen
Starší čeledín datovýho chlíva
From:
Fabien COELHO
Date:

Hello,

>> There are different flavour of markdown, maybe you should document which
>> one is targetted. Should it be CommonMark? Another variant? Why?
>
> This should be pandoc pipe table. It's because it is similar to aligned
> format. I need add this to documentation (i have it in recent TODO)

I still do not understand "why" this variant vs CommonMark or whatever 
other version.

>> ISTM that the md format lacks escaping for special md characters [...] 
>> I'd say that you need to do escaping more or less similar to html?
>
> There is problem with markown and newlines. Replacing newline by br was
> only solution that I was able to find.

Fine. That does not answer the question about escaping other special md 
characters.

>> Also, it seems that you use distinct vertical bar characters in the
>> format? Or is this a trick of my terminal?? It seems that your patch
>> introduces U+2502 (BOX DRAWINGS LIGHT VERTICAL) instead of the usual pipe
>> in some places. Maybe you copy-pasted things from the unicode linestyle.
>
> Main of the functionality is used from aligned format. I tested returned
> tables in retext and it works. If i have another character than standart
> pipe, it shouldn`t work.

Sure. ISTM that you are currently using U+2502 instead of pipe, hence my 
point.

>> Why are *_newline variants added for length and formatting? Would it be
>> possible to do without, say by relying on the line count computed by the
>> standard function for instance?
>
> It`s because newlines in markdown, If I need to do it without copy this
> function, i had to add parameter for markdown to this functions.

Then maybe it is an option to consider to avoid duplicating code.

-- 
Fabien.



From:
Jan Michálek
Date:



2017-04-18 23:06 GMT+02:00 Fabien COELHO <>:

Hello,

There are different flavour of markdown, maybe you should document which
one is targetted. Should it be CommonMark? Another variant? Why?

This should be pandoc pipe table. It's because it is similar to aligned
format. I need add this to documentation (i have it in recent TODO)

I still do not understand "why" this variant vs CommonMark or whatever other version.

Because of simply implementation and readability (looks similar to aligned format) and it is comfortable to edit generated table (changing values, aligning columns etc.).
 

ISTM that the md format lacks escaping for special md characters [...] I'd say that you need to do escaping more or less similar to html?

There is problem with markown and newlines. Replacing newline by br was
only solution that I was able to find.

Fine. That does not answer the question about escaping other special md characters.

Sorry, maybe I`m not understanding, there is problems with characters like pipe in cells, pipe should be escaped. What other special markdown characters? Escaping html code in cells?
 

Also, it seems that you use distinct vertical bar characters in the
format? Or is this a trick of my terminal?? It seems that your patch
introduces U+2502 (BOX DRAWINGS LIGHT VERTICAL) instead of the usual pipe
in some places. Maybe you copy-pasted things from the unicode linestyle.

Main of the functionality is used from aligned format. I tested returned
tables in retext and it works. If i have another character than standart
pipe, it shouldn`t work.

Sure. ISTM that you are currently using U+2502 instead of pipe, hence my point.

Could you send me example where?
 

Why are *_newline variants added for length and formatting? Would it be
possible to do without, say by relying on the line count computed by the
standard function for instance?

It`s because newlines in markdown, If I need to do it without copy this
function, i had to add parameter for markdown to this functions.

Then maybe it is an option to consider to avoid duplicating code.

--
Fabien.



--
Jelen
Starší čeledín datovýho chlíva
From:
Fabien COELHO
Date:

>> I still do not understand "why" this variant vs CommonMark or whatever
>> other version.
>
> Because of simply implementation and readability (looks similar to aligned
> format) and it is comfortable to edit generated table (changing values,
> aligning columns etc.).

Hmmm. Why not.

> Sorry, maybe I`m not understanding, there is problems with characters like
> pipe in cells, pipe should be escaped. What other special markdown
> characters? Escaping html code in cells?

Markdown include characters/sequences which are interpreted as markers: 
_Italic_, **Bold**, *** => horizontal rules, > block quote... `inline 
code`... If they are interpreted within a table cell then probably they 
should be escaped somehow.

>>> Main of the functionality is used from aligned format. I tested returned
>>> tables in retext and it works. If i have another character than standart
>>> pipe, it shouldn`t work.
>>>
>> Sure. ISTM that you are currently using U+2502 instead of pipe, hence my
>> point.
>
> Could you send me example where?

I already did in the first mail with the example output copy pasted from 
psql. Some characters are pipe and others are BOX DRAWINGS LIGHT VERTICAL 
characters.

Maybe this is because I have in my ~/.psqlrc:
 \pset linestyle unicode \pset border 2

in which case your reuse of the the aligned stuff should take care of the 
border setting to avoid using special UTF8 characters..

-- 
Fabien.



From:
Jan Michálek
Date:

2017-04-19 9:18 GMT+02:00 Fabien COELHO <>:

I still do not understand "why" this variant vs CommonMark or whatever
other version.

Because of simply implementation and readability (looks similar to aligned
format) and it is comfortable to edit generated table (changing values,
aligning columns etc.).

Hmmm. Why not.

Sorry, maybe I`m not understanding, there is problems with characters like
pipe in cells, pipe should be escaped. What other special markdown
characters? Escaping html code in cells?

Markdown include characters/sequences which are interpreted as markers: _Italic_, **Bold**, *** => horizontal rules, > block quote... `inline code`... If they are interpreted within a table cell then probably they should be escaped somehow.

I`m able to sanitize characters, but complex sequences will be problem. I will look on this, but I don`t know, if I`m able to do this.

My main interest on this was in rst. I`m using markdown only in github issues and my knowldge about md is poor.
 

Main of the functionality is used from aligned format. I tested returned
tables in retext and it works. If i have another character than standart
pipe, it shouldn`t work.

Sure. ISTM that you are currently using U+2502 instead of pipe, hence my
point.

Could you send me example where?

I already did in the first mail with the example output copy pasted from psql. Some characters are pipe and others are BOX DRAWINGS LIGHT VERTICAL characters.

Maybe this is because I have in my ~/.psqlrc:

 \pset linestyle unicode
 \pset border 2

in which case your reuse of the the aligned stuff should take care of the border setting to avoid using special UTF8 characters..

Yes, it looks it is done by linestyle.


jelen=# SELECT 1;

| ?column? |
|----------|
|        1 |


(1 row)

jelen=# \pset linestyle unicode
Line style is unicode.
jelen=# SELECT 1;

│ ?column? │
|----------|
│        1 │


(1 row)

jelen=#

I have prepared linestyle for rst and md, but I can`t switch linestyle outside, because if i did it
\pset linestyle
wrote "markdown" or "rst".
I see, problem is only in cells borders, I will correct this.

Jan
 

--
Fabien.



--
Jelen
Starší čeledín datovýho chlíva
From:
Jan Michálek
Date:



2017-04-19 10:05 GMT+02:00 Jan Michálek <>:
2017-04-19 9:18 GMT+02:00 Fabien COELHO <>:

I still do not understand "why" this variant vs CommonMark or whatever
other version.

Because of simply implementation and readability (looks similar to aligned
format) and it is comfortable to edit generated table (changing values,
aligning columns etc.).

Hmmm. Why not.

Sorry, maybe I`m not understanding, there is problems with characters like
pipe in cells, pipe should be escaped. What other special markdown
characters? Escaping html code in cells?

Markdown include characters/sequences which are interpreted as markers: _Italic_, **Bold**, *** => horizontal rules, > block quote... `inline code`... If they are interpreted within a table cell then probably they should be escaped somehow.


I have treated "_*|<>"

jelen=# SELECT E'**1**</br>\nrrr';
| **RECORD 1** |                              |
|--------------|------------------------------|
| ?column?     | \*\*1\*\*&lt;/br&gt;</br>rrr |


jelen=# 

I`m able to sanitize characters, but complex sequences will be problem. I will look on this, but I don`t know, if I`m able to do this.

My main interest on this was in rst. I`m using markdown only in github issues and my knowldge about md is poor.
 

Main of the functionality is used from aligned format. I tested returned
tables in retext and it works. If i have another character than standart
pipe, it shouldn`t work.

Sure. ISTM that you are currently using U+2502 instead of pipe, hence my
point.

Could you send me example where?

I already did in the first mail with the example output copy pasted from psql. Some characters are pipe and others are BOX DRAWINGS LIGHT VERTICAL characters.

Maybe this is because I have in my ~/.psqlrc:

 \pset linestyle unicode
 \pset border 2

in which case your reuse of the the aligned stuff should take care of the border setting to avoid using special UTF8 characters..

I corrected it.

jelen=# \pset linestyle unicode
Line style is unicode.
jelen=# SELECT 1,2,3,4;
| **RECORD 1** |   |
|--------------|---|
| ?column?     | 1 |
| ?column?     | 2 |
| ?column?     | 3 |
| ?column?     | 4 |


jelen=#

Regards
Jan

 

Yes, it looks it is done by linestyle.


jelen=# SELECT 1;

| ?column? |
|----------|
|        1 |


(1 row)

jelen=# \pset linestyle unicode
Line style is unicode.
jelen=# SELECT 1;

│ ?column? │
|----------|
│        1 │


(1 row)

jelen=#

I have prepared linestyle for rst and md, but I can`t switch linestyle outside, because if i did it
\pset linestyle
wrote "markdown" or "rst".
I see, problem is only in cells borders, I will correct this.

Jan
 

--
Fabien.



--
Jelen
Starší čeledín datovýho chlíva



--
Jelen
Starší čeledín datovýho chlíva
From:
Fabien COELHO
Date:

Hello Jan,

Please give a number to submitted patches. I think that this was v3.

The patch does NOT fix various issues I pointed out in my previous review:
 - tabs introduced in "doc/src/sgml/ref/psql-ref.sgml" - too long help line in "src/bin/psql/help.c" - spurious space
aftera comma in "src/fe_utils/print.c"   and possibly elsewhere.
 

On Sun, 23 Apr 2017, Jan Michálek wrote:

>>> Markdown include characters/sequences which are interpreted as markers:
>>> _Italic_, **Bold**, *** => horizontal rules, > block quote... `inline
>>> code`... If they are interpreted within a table cell then probably they
>>> should be escaped somehow.
>
> I have treated "_*|<>"

Probably not enough, see below. Note the escaping chars should also be 
escaped.

>> I`m able to sanitize characters, but complex sequences will be problem. I
>> will look on this, but I don`t know, if I`m able to do this.

I do not know whether only those are necessary. Have you checked? Guessing 
is probably not the right approach.


Concerning MARKDOWN, and according to the following source about github 
markdown implementation:
    https://enterprise.github.com/downloads/en/markdown-cheatsheet.pdf

The following characters may need to be backslash escaped, although it 
does not cover HTML stuff.
    \   backslash    `   backtick    *   asterisk    _   underscore    {}  curly braces    []  square brackets    ()
parentheses   #   hash mark    +   plus sign    -   minus sign (hyphen)    .   dot    !   exclamation
 

Another source https://genius.com/3057216 suggests (* # / ( ) [ ] < >),
which should protect HTML.

However, the escaping seems to be the backslash character, NOT using html 
encoding < as done in your version.

Where did you find the precise escaping rules for markdown? I do not think 
that it should be invented...


I have looked at RST, according to this reference:
    http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#grid-tables

The good news is that you do not need to handle a special | case because 
you would only produce clean tables.

I've tested UTF-8 with plane 1 (你好!) and plane 2 (𠀡) and the alignment 
seems to worked well, incredible!

>> My main interest on this was in rst. I`m using markdown only in github 
>> issues and my knowldge about md is poor.

Then maybe only do RST?!

It looks much simpler anyway, and if you do MARKDOWN the support needs to 
be clean.

About the code:

I'm still at odds with the code which needs to test for markdown to call 
for different functions in multiple places. If you keep md and in order to 
avoid that, I would suggest to extend the pg_wcs* functions with a list of 
caracters which may have different sizes with additionnal args, say:
  pg_wcssize(// same args, plus:             char * escaped_chars, // will require escaping             int escape_len,
//how many chars added when escaping             int nllen // len of newline if substituted             );
 

So that pg_wcssize(..., "\r", 1, 1) would behave as before (\n and \t are 
rather special cases), and the various constants could be held in the 
format description so the whole thing would be parametric.

Same approach with format.

That would allow to simplify the code significantly and to share it 
between MARKDOWN and others. Also, the multiple "else if" list would be 
simplified by using strchr or the escaped_chars string.

-- 
Fabien.

From:
Fabien COELHO
Date:

<resent, wrong from, sorry for those who may get multiple copies>

Hello Jan,

Please give a number to submitted patches. I think that this was v3.

The patch does NOT fix various issues I pointed out in my previous review:
 - tabs introduced in "doc/src/sgml/ref/psql-ref.sgml" - too long help line in "src/bin/psql/help.c" - spurious space
aftera comma in "src/fe_utils/print.c"   and possibly elsewhere.
 

On Sun, 23 Apr 2017, Jan Michálek wrote:

> > > Markdown include characters/sequences which are interpreted as markers:
> > > _Italic_, **Bold**, *** => horizontal rules, > block quote... `inline
> > > code`... If they are interpreted within a table cell then probably they
> > > should be escaped somehow.
> 
> I have treated "_*|<>"

Probably not enough, see below. Note the escaping chars should also be escaped.

> > I`m able to sanitize characters, but complex sequences will be problem. I
> > will look on this, but I don`t know, if I`m able to do this.

I do not know whether only those are necessary. Have you checked? Guessing is
probably not the right approach.


Concerning MARKDOWN, and according to the following source about github markdown
implementation:
    https://enterprise.github.com/downloads/en/markdown-cheatsheet.pdf

The following characters may need to be backslash escaped, although it does not
cover HTML stuff.
    \   backslash    `   backtick    *   asterisk    _   underscore    {}  curly braces    []  square brackets    ()
parentheses   #   hash mark    +   plus sign    -   minus sign (hyphen)    .   dot    !   exclamation
 

Another source https://genius.com/3057216 suggests (* # / ( ) [ ] < >),
which should protect HTML.

However, the escaping seems to be the backslash character, NOT using html
encoding < as done in your version.

Where did you find the precise escaping rules for markdown? I do not think that
it should be invented...


I have looked at RST, according to this reference:
    http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#grid-
tables

The good news is that you do not need to handle a special | case because you
would only produce clean tables.

I've tested UTF-8 with plane 1 (你好!) and plane 2 (𠀡) and the alignment seems
to worked well, incredible!

> > My main interest on this was in rst. I`m using markdown only in github
> > issues and my knowldge about md is poor.

Then maybe only do RST?!

It looks much simpler anyway, and if you do MARKDOWN the support needs to be
clean.

About the code:

I'm still at odds with the code which needs to test for markdown to call for
different functions in multiple places. If you keep md and in order to avoid
that, I would suggest to extend the pg_wcs* functions with a list of caracters
which may have different sizes with additionnal args, say:
  pg_wcssize(// same args, plus:             char * escaped_chars, // will require escaping             int escape_len,
//how many chars added when escaping             int nllen // len of newline if substituted             );
 

So that pg_wcssize(..., "\r", 1, 1) would behave as before (\n and \t are rather
special cases), and the various constants could be held in the format
description so the whole thing would be parametric.

Same approach with format.

That would allow to simplify the code significantly and to share it between
MARKDOWN and others. Also, the multiple "else if" list would be simplified by
using strchr or the escaped_chars string.

-- 
Fabien.

From:
Daniel Gustafsson
Date:

> On 08 May 2017, at 12:02, Fabien COELHO <> wrote:
>
> Hello Jan,
>
> Please give a number to submitted patches. I think that this was v3.
>
> The patch does NOT fix various issues I pointed out in my previous review:
>
> - tabs introduced in "doc/src/sgml/ref/psql-ref.sgml"
> - too long help line in "src/bin/psql/help.c"
> - spurious space after a comma in "src/fe_utils/print.c"
>   and possibly elsewhere.
>
> On Sun, 23 Apr 2017, Jan Michálek wrote:
>
>>>> Markdown include characters/sequences which are interpreted as markers:
>>>> _Italic_, **Bold**, *** => horizontal rules, > block quote... `inline
>>>> code`... If they are interpreted within a table cell then probably they
>>>> should be escaped somehow.
>>
>> I have treated "_*|<>"
>
> Probably not enough, see below. Note the escaping chars should also be escaped.
>
>>> I`m able to sanitize characters, but complex sequences will be problem. I
>>> will look on this, but I don`t know, if I`m able to do this.
>
> I do not know whether only those are necessary. Have you checked? Guessing is probably not the right approach.
>
>
> Concerning MARKDOWN, and according to the following source about github markdown implementation:
>
>     https://enterprise.github.com/downloads/en/markdown-cheatsheet.pdf
>
> The following characters may need to be backslash escaped, although it does not cover HTML stuff.
>
>     \   backslash
>     `   backtick
>     *   asterisk
>     _   underscore
>     {}  curly braces
>     []  square brackets
>     ()  parentheses
>     #   hash mark
>     +   plus sign
>     -   minus sign (hyphen)
>     .   dot
>     !   exclamation
>
> Another source https://genius.com/3057216 suggests (* # / ( ) [ ] < >),
> which should protect HTML.
>
> However, the escaping seems to be the backslash character, NOT using html encoding < as done in your version.
>
> Where did you find the precise escaping rules for markdown? I do not think that it should be invented...
>
>
> I have looked at RST, according to this reference:
>
>     http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#grid-tables
>
> The good news is that you do not need to handle a special | case because you would only produce clean tables.
>
> I've tested UTF-8 with plane 1 (你好!) and plane 2 (𠀡) and the alignment seems to worked well, incredible!
>
>>> My main interest on this was in rst. I`m using markdown only in github issues and my knowldge about md is poor.
>
> Then maybe only do RST?!
>
> It looks much simpler anyway, and if you do MARKDOWN the support needs to be clean.
>
> About the code:
>
> I'm still at odds with the code which needs to test for markdown to call for different functions in multiple places.
Ifyou keep md and in order to avoid that, I would suggest to extend the pg_wcs* functions with a list of caracters
whichmay have different sizes with additionnal args, say: 
>
>  pg_wcssize(// same args, plus:
>             char * escaped_chars, // will require escaping
>             int escape_len, // how many chars added when escaping
>             int nllen // len of newline if substituted
>             );
>
> So that pg_wcssize(..., "\r", 1, 1) would behave as before (\n and \t are rather special cases), and the various
constantscould be held in the format description so the whole thing would be parametric. 
>
> Same approach with format.
>
> That would allow to simplify the code significantly and to share it between MARKDOWN and others. Also, the multiple
"elseif" list would be simplified by using strchr or the escaped_chars string. 

This patch was moved into the current Commitfest marked “Waiting for author”
with the above review.  Have you had a chance to work on it addressing the
review comments such that we can expect a new version within this CF?

cheers ./daniel

--
Sent via pgsql-hackers mailing list ()
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

From:
Jan Michálek
Date:

I have`t any new version recently, because i was waiting for new version. But I will have some time on this in next months. How many time I have to next freeze?

Thanks Je;

2017-09-13 1:14 GMT+02:00 Daniel Gustafsson <>:
> On 08 May 2017, at 12:02, Fabien COELHO <fabien.coelho@mines-paristech.fr> wrote:
>
> Hello Jan,
>
> Please give a number to submitted patches. I think that this was v3.
>
> The patch does NOT fix various issues I pointed out in my previous review:
>
> - tabs introduced in "doc/src/sgml/ref/psql-ref.sgml"
> - too long help line in "src/bin/psql/help.c"
> - spurious space after a comma in "src/fe_utils/print.c"
>   and possibly elsewhere.
>
> On Sun, 23 Apr 2017, Jan Michálek wrote:
>
>>>> Markdown include characters/sequences which are interpreted as markers:
>>>> _Italic_, **Bold**, *** => horizontal rules, > block quote... `inline
>>>> code`... If they are interpreted within a table cell then probably they
>>>> should be escaped somehow.
>>
>> I have treated "_*|<>"
>
> Probably not enough, see below. Note the escaping chars should also be escaped.
>
>>> I`m able to sanitize characters, but complex sequences will be problem. I
>>> will look on this, but I don`t know, if I`m able to do this.
>
> I do not know whether only those are necessary. Have you checked? Guessing is probably not the right approach.
>
>
> Concerning MARKDOWN, and according to the following source about github markdown implementation:
>
>       https://enterprise.github.com/downloads/en/markdown-cheatsheet.pdf
>
> The following characters may need to be backslash escaped, although it does not cover HTML stuff.
>
>       \   backslash
>       `   backtick
>       *   asterisk
>       _   underscore
>       {}  curly braces
>       []  square brackets
>       ()  parentheses
>       #   hash mark
>       +   plus sign
>       -   minus sign (hyphen)
>       .   dot
>       !   exclamation
>
> Another source https://genius.com/3057216 suggests (* # / ( ) [ ] < >),
> which should protect HTML.
>
> However, the escaping seems to be the backslash character, NOT using html encoding &lt; as done in your version.
>
> Where did you find the precise escaping rules for markdown? I do not think that it should be invented...
>
>
> I have looked at RST, according to this reference:
>
>       http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#grid-tables
>
> The good news is that you do not need to handle a special | case because you would only produce clean tables.
>
> I've tested UTF-8 with plane 1 (你好!) and plane 2 (𠀡) and the alignment seems to worked well, incredible!
>
>>> My main interest on this was in rst. I`m using markdown only in github issues and my knowldge about md is poor.
>
> Then maybe only do RST?!
>
> It looks much simpler anyway, and if you do MARKDOWN the support needs to be clean.
>
> About the code:
>
> I'm still at odds with the code which needs to test for markdown to call for different functions in multiple places. If you keep md and in order to avoid that, I would suggest to extend the pg_wcs* functions with a list of caracters which may have different sizes with additionnal args, say:
>
>  pg_wcssize(// same args, plus:
>             char * escaped_chars, // will require escaping
>             int escape_len, // how many chars added when escaping
>             int nllen // len of newline if substituted
>             );
>
> So that pg_wcssize(..., "\r", 1, 1) would behave as before (\n and \t are rather special cases), and the various constants could be held in the format description so the whole thing would be parametric.
>
> Same approach with format.
>
> That would allow to simplify the code significantly and to share it between MARKDOWN and others. Also, the multiple "else if" list would be simplified by using strchr or the escaped_chars string.

This patch was moved into the current Commitfest marked “Waiting for author”
with the above review.  Have you had a chance to work on it addressing the
review comments such that we can expect a new version within this CF?

cheers ./daniel



--
Jelen
Starší čeledín datovýho chlíva
From:
Daniel Gustafsson
Date:

> On 18 Sep 2017, at 15:31, Jan Michálek <> wrote:
>
> I have`t any new version recently, because i was waiting for new version. But I will have some time on this in next
months.How many time I have to next freeze? 

The next commitfest runs from 2017-11-01 to 2017-11-30, I will move your patch
there.

cheers ./daniel

--
Sent via pgsql-hackers mailing list ()
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

From:
Jan Michálek
Date:

Thanks

2017-09-18 15:33 GMT+02:00 Daniel Gustafsson <>:
> On 18 Sep 2017, at 15:31, Jan Michálek <> wrote:
>
> I have`t any new version recently, because i was waiting for new version. But I will have some time on this in next months. How many time I have to next freeze?

The next commitfest runs from 2017-11-01 to 2017-11-30, I will move your patch
there.

cheers ./daniel



--
Jelen
Starší čeledín datovýho chlíva
From:
Michael Paquier
Date:

On Mon, Sep 18, 2017 at 10:33 PM, Daniel Gustafsson <> wrote:
>> On 18 Sep 2017, at 15:31, Jan Michálek <> wrote:
>>
>> I have`t any new version recently, because i was waiting for new version. But I will have some time on this in next
months.How many time I have to next freeze? 
>
> The next commitfest runs from 2017-11-01 to 2017-11-30, I will move your patch
> there.

It's been 1 month and a half since this last status, and no updates
have showed up. I am marking this patch as returned with feedback. If
you are able to reproduce a new version, please make sure to register
it in the commit fest for review.
--
Michael


From:
Jan Michálek
Date:

Sorry, I haven`t any new progres. Can you move my patch to next (or it is problem)? I have to solve some personal issues. I want to finish this, but im not able to promise, that it will be in next months. Je; 2017-11-28 2:43 GMT+01:00 Michael Paquier <>: > On Mon, Sep 18, 2017 at 10:33 PM, Daniel Gustafsson <> > wrote: > >> On 18 Sep 2017, at 15:31, Jan Michálek <> wrote: > >> > >> I have`t any new version recently, because i was waiting for new > version. But I will have some time on this in next months. How many time I > have to next freeze? > > > > The next commitfest runs from 2017-11-01 to 2017-11-30, I will move your > patch > > there. > > It's been 1 month and a half since this last status, and no updates > have showed up. I am marking this patch as returned with feedback. If > you are able to reproduce a new version, please make sure to register > it in the commit fest for review. > -- > Michael > -- Jelen Starší čeledín datovýho chlíva
From:
Daniel Gustafsson
Date:

> On 28 Nov 2017, at 12:01, Jan Michálek <> wrote:
>
> Sorry, I haven`t any new progres.
> Can you move my patch to next (or it is problem)? I have to solve some personal issues. I want to finish this, but im
notable to promise, that it will be in next months. 

No problems, it has been returned with feedback which doesn’t mean “no thanks,
it means “re-register it in the then open commitfest when you have had time to
fix a new version.

When you have had time to hack on it, just add it again and it will be up for
review.

cheers ./daniel

From:
Jan Michálek
Date:

Thanks My english is little bit poor and my understanding of formal part of commit process is only partial. 2017-11-28 12:07 GMT+01:00 Daniel Gustafsson <>: > > > On 28 Nov 2017, at 12:01, Jan Michálek <> wrote: > > > > Sorry, I haven`t any new progres. > > Can you move my patch to next (or it is problem)? I have to solve some > personal issues. I want to finish this, but im not able to promise, that it > will be in next months. > > No problems, it has been returned with feedback which doesn’t mean “no > thanks, > it means “re-register it in the then open commitfest when you have had > time to > fix a new version. > > When you have had time to hack on it, just add it again and it will be up > for > review. > > cheers ./daniel -- Jelen Starší čeledín datovýho chlíva
From:
Michael Paquier
Date:

On Tue, Nov 28, 2017 at 9:20 PM, Jan Michálek <> wrote:
> Thanks

Please avoid top-posting. This breaks the thread logic.

> My english is little bit poor and my understanding of formal part of commit
> process is only partial.

Don't worry, we'll all here to learn. If you are able to hack a new
version, please feel free to post a new patch and register a new entry
in the commit fest application.
--
Michael


From:
Jan Michálek
Date:

2017-11-28 13:32 GMT+01:00 Michael Paquier <>: > On Tue, Nov 28, 2017 at 9:20 PM, Jan Michálek <> > wrote: > > Thanks > > Please avoid top-posting. This breaks the thread logic. > Oh, sorry > > > My english is little bit poor and my understanding of formal part of > commit > > process is only partial. > > Don't worry, we'll all here to learn. If you are able to hack a new > version, please feel free to post a new patch and register a new entry > in the commit fest application. > -- > Michael > -- Jelen Starší čeledín datovýho chlíva