Alternate output format for psql

前端 未结 7 1850
迷失自我
迷失自我 2020-12-04 04:44

I am using PostgreSQL 8.4 on Ubuntu. I have a table with columns c1 through cN. The columns are wide enough that selecting all columns causes a row

7条回答
  •  粉色の甜心
    2020-12-04 05:19

    you can use the zenity to displays the query output as html table.

    • first implement bash script with following code:

      cat > '/tmp/sql.op'; zenity --text-info --html --filename='/tmp/sql.op';

      save it like mypager.sh

    • Then export the environment variable PAGER by set full path of the script as value.

      for example:- export PAGER='/path/mypager.sh'

    • Then login to the psql program then execute the command \H

    • And finally execute any query,the tabled output will displayed in the zenity in html table format.

提交回复
热议问题