Re: psql format result as markdown tables
От | Vick Khera |
---|---|
Тема | Re: psql format result as markdown tables |
Дата | |
Msg-id | CALd+dce8buMF2XRQ8qdgvhY5UdADAGh8ri+hW=u+vgeDxWbL-A@mail.gmail.com обсуждение исходный текст |
Ответ на | psql format result as markdown tables (Nicolas Paris <niparisco@gmail.com>) |
Список | pgsql-general |
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@gmail.com> 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
В списке pgsql-general по дате отправления: