Skip to content
A small script to make pretty html tables from psql
Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
images
README.md
make_pretty_table.sh

README.md

A small script to make pretty html tables from psql

Installation

Put the shell script in PATH. On OS X, brew install gnu-sed.

On Linux, change references to gsed to sed and open -a Safari to xdg-open or firefox equivalent.

Usage

  1. In psql,
\H -- html mode
\o test.html
select * from mytable; -- or any other query.
\o -- so that it no longer prints to file
\H -- disable html mode
  1. In shell,
make_pretty_table.sh test.html

or even better, while staying in psql

\! make_pretty_table.sh test.html

This will create a file test_enhanced.html and open it in a web browser.

Example

To get all tables in the system in html,

In postgres,

\H -- html mode
\o test.html
\dt+
\o
\! make_pretty_table test.html

unfiltered filtered

You can’t perform that action at this time.