Greetings Melvin, * Melvin Davidson (melvin6925@xxxxxxxxx) wrote: > On Sat, Jan 13, 2018 at 4:50 AM, Nicolas Paris <niparisco@xxxxxxxxx> wrote: > > 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 > > *A. You have not graced us with PostgreSQL version and O/S* While it can make a difference, it doesn't in this case, as far as I can tell. You can see the list of formats supported by each version of PostgreSQL by going to: https://www.postgresql.org/docs/current/static/app-psql.html and then you can walk backwards through the various releases. > *B. Your two examples appear exactly the same.* Not true, actually, if you look carefully you'll see that there's a set of pipes down the left-hand side, and pipes all down the middle (instead of a '+' on the linebreak between the header and the data). Those kinds of differences are what would make having an actual markdown output format for psql particularly useful as, otherwise, you have to hand-massage it or use another tool. > *C. Have you looked at https://donatstudios.com/CsvToMarkdownTable > <https://donatstudios.com/CsvToMarkdownTable> ?* That might be helpful in this case, though it would require sending data to an 3rd party, which might not be ideal. There's a number of csv2markdown tools out there though which could be installed locally. Not quite as nice as having the support in psql for it though. Thanks! Stephen
Attachment:
signature.asc
Description: PGP signature