How does this work for you? I use this to get tables to insert into my wiki, which are basically the format you want. I just delete the extra lines I don't want at the end.
vk=> SELECT * FROM (values(1,2),(3,4)) as t;
column1 | column2
---------+---------
1 | 2
3 | 4
(2 rows)
Time: 37.888 ms
vk=> \pset border 2
Border style is 2.
vk=> SELECT * FROM (values(1,2),(3,4)) as t;
+---------+---------+
| column1 | column2 |
+---------+---------+
| 1 | 2 |
| 3 | 4 |
+---------+---------+
(2 rows)
For you it looks like you need to change the "+" to "|" and it will work and delete the first and last lines. I don't know if you can change that with some other \pset setting.
On Sat, Jan 13, 2018 at 4:50 AM, Nicolas Paris <niparisco@xxxxxxxxx> wrote:
Hello
I wonder if someone knows how to configure psql to output results as
markdown tables.
Then instead of :
SELECT * FROM (values(1,2),(3,4)) as t;
column1 | column2
---------+---------
1 | 2
3 | 4
Get the result as :
SELECT * FROM (values(1,2),(3,4)) as t;
| column1 | column2|
|---------|--------|-
| 1 | 2|
| 3 | 4|
Thanks by advance