psql

Posted on:

This is the setting for psql, a client tool for PostgreSQL.

psql

This is the recommended setting for PSQL_PAGER. Header 1 is specified(-H1),"|" is used to separate columns(-d "|"), and column mode(-C) is set. If it fits on the screen, exit the pager(-F). It is also recommended to change the color of the columns(--column-rainbow).

The --align option added in v0.37.0 can also be used to shrink columns.

PSQL_PAGER 'ov -F -C -d "|" -H1 --column-rainbow --align'

The following sets the header style of config.yaml.

StyleHeader:
  Background: "#23274f"
  Bold: true
StyleColumnHighlight:
  Foreground: "lightcyan"
  Reverse: true
StyleAlternate:
  Background: "#2a2a2a"

psql psql

watch(PostgreSQL 15)

A pager is available for WATCH from PostgreSQL version 15. This is the recommended value for PSQL_WATCH_PAGER. Continues to display the last section separated by blank lines.

PSQL_WATCH_PAGER 'ov --follow-section --section-delimiter "^$"'

watch watch

expanded output (\x)

Even when displaying in the extended output (\x), if the record delimiter is treated as a section delimiter, the display when moved will be easier to see.

PAGER='ov -F --section-delimiter "^-"'

\\x \\x

You can also display expanded output (\x) with \watch.

watch2 watch2

unaligned (\a)

By specifying \a on the psql side, you can display without alignment (without aligning columns) by specifying the --align option of ov.

PSQL_PAGER='ov -F -C -d "|" -H1 --column-rainbow --align'

unalign unalign