Skip to content

Commit c76e62b

Browse files
committed
update man page
1 parent d7e1a58 commit c76e62b

File tree

1 file changed

+101
-36
lines changed

1 file changed

+101
-36
lines changed

pspg.1

Lines changed: 101 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.\" generated with Ronn-NG/v0.9.1
22
.\" http://github.com/apjanke/ronn-ng/tree/0.9.1
3-
.TH "PSPG" "1" "February 2023" "" "pspg manual"
3+
.TH "PSPG" "1" "February 2024" "" "pspg manual"
44
.SH "NAME"
55
\fBpspg\fR \- Postgres Pager
66
.P
@@ -36,6 +36,28 @@ mouse is supported and used
3636
.IP "\[ci]" 4
3737
ability to copy a selected range to the clipboard
3838
.IP "" 0
39+
.SH "Installation and basic configuration"
40+
The \fBpspg\fR can be simply installed from Debian (Ubuntu) repositories\. RedHat (Fedora) repositories contains \fBpspg\fR too:
41+
.IP "" 4
42+
.nf
43+
# Debian (Ubuntu)
44+
sudo apt\-get install pspg
45+
46+
# RedHat (Fedora)
47+
sudo dnf install pspg
48+
.fi
49+
.IP "" 0
50+
.P
51+
Basic configuration is very simple \- just set system environment variable \fBPSQL_PAGER\fR:
52+
.IP "" 4
53+
.nf
54+
export PSQL_PAGER=\'pspg \-X \-b\'
55+
.fi
56+
.IP "" 0
57+
.P
58+
Native installation on MS Windows is not supported, but \fBpspg\fR works well inside \fBwsl2\fR\. Inside wsl2 environment, the installation is same like on used Linux system\.
59+
.P
60+
Installation on macOS/homebrew is simple by \fBbrew install pspg\fR\.
3961
.SH "Video presentation"
4062
\fIhttps://www\.youtube\.com/watch?v=JyxuEkoYDQk\fR
4163
.SH "Screenshots"
@@ -89,7 +111,7 @@ Output format options:
89111
\-\-force\-uniborder replace ascii borders by unicode borders
90112
\-\-highlight\-odd\-rec highlights odd records (when it is supported by style)
91113
\-\-hide\-header\-line hides header line (between column names and data)
92-
\-\-ignore\-bad\-rows rows with wrong column numbers are ignored
114+
\-\-ignore\-short\-rows rows with wrong column numbers are ignored
93115
\-\-null=STRING STRING used instead NULL
94116

95117
Searching options
@@ -118,6 +140,8 @@ Input format options:
118140
\-\-csv\-header [on/off] specify header line usage
119141
\-\-skip\-columns\-like="SPACE SEPARATED STRING LIST"
120142
columns with substr in name are ignored
143+
\-\-csv\-trim\-width=NUM trim value after NUM chars
144+
\-\-csv\-trim\-rows=NUM trim value after NUM rows
121145
\-\-tsv input stream has tsv format
122146

123147
On exit options:
@@ -130,7 +154,7 @@ Watch mode options:
130154
\-q, \-\-query=QUERY execute query
131155
\-w, \-\-watch time the query (or read file) is repeated every time (sec)
132156

133-
Connection options
157+
Connection options:
134158
\-d, \-\-dbname=DBNAME database name
135159
\-h, \-\-host=HOSTNAME database server host (default: "local socket")
136160
\-p, \-\-port=PORT database server port (default: "5432")
@@ -150,7 +174,7 @@ Options can be passed within the environment variable \fBPSPG\fR, too\.
150174
allbox;
151175
l l.
152176
Name Usage
153-
\fBPSPG\fR can holds same options like command line
177+
\fBPSPG\fR can hold same options like command line
154178
\fBPSPG_CONF\fR path to configuration file
155179
\fBPSPG_HISTORY\fR path to file pspg\'s readline history file
156180
.TE
@@ -216,7 +240,7 @@ scrollbar_slider = white, gray
216240
.fi
217241
.IP "" 0
218242
.P
219-
Some keys can be marked by symobol \fB*\fR\. Marked keys are used for odd records\.
243+
Some keys can be marked by symbol \fB*\fR\. Marked keys are used for odd records\.
220244
.IP "" 4
221245
.nf
222246
data* = black, lightgray
@@ -350,15 +374,15 @@ Command Description
350374
\fB\etheme N\fR set theme number
351375
\fB\ecopy [all\e|selected] [nullstr "str"] [csv\e|tsv\e|insert\e|text\e|pipesep\e|sqlvalues]\fR copy data to clipboard
352376
\fB\esave [all\e|selected] [nullstr "str"] [csv\e|tsv\e|insert\e|text\e|pipesep\e|sqlvalues]\fR copy data to clipboard
353-
\fB\eorder [N\e|colum name]\fR sort by colum
354-
\fB\eorderd [N\e|colum name]\fR desc sort by column
355-
\fB\esort [N\e|colum name]\fR sort by colum
356-
\fB\esortd [N\e|colum name]\fR desc sort by column
357-
\fB\edsort [N\e|colum name]\fR desc sort by column (alias)
358-
\fB\ersort [N\e|colum name]\fR desc sort by column (alias)
359-
\fB\easc [N\e|colum name]\fR sort by colum (alias)
360-
\fB\edesc [N\e|colum name]\fR desc sort by colum (alias)
361-
\fB\esearch [back] [selected] [colum name] [string\e|"string"]\fR search string in data
377+
\fB\eorder [N\e|column name]\fR sort by column
378+
\fB\eorderd [N\e|column name]\fR desc sort by column
379+
\fB\esort [N\e|column name]\fR sort by column
380+
\fB\esortd [N\e|column name]\fR desc sort by column
381+
\fB\edsort [N\e|column name]\fR desc sort by column (alias)
382+
\fB\ersort [N\e|column name]\fR desc sort by column (alias)
383+
\fB\easc [N\e|column name]\fR sort by column (alias)
384+
\fB\edesc [N\e|column name]\fR desc sort by column (alias)
385+
\fB\esearch [back] [selected] [column name] [string\e|"string"]\fR search string in data
362386
.TE
363387
.P
364388
The output can be redirected to any command when the name starts with pipe symbol:
@@ -370,18 +394,18 @@ The output can be redirected to any command when the name starts with pipe symbo
370394
.SH "Ending"
371395
The pager can be ended by pressing keys \fBq\fR or \fBF10\fR or \fBEsc\fR \fB0\fR\. With option \fB\-\-on\-sigint\-exit\fR then the pager is closed by pressing keys \fBCtrl\fR+\fBc\fR or \fBEsc\fR \fBEsc\fR\.
372396
.SH "Use <kbd>Escape</kbd>, key instead <key>Alt</key> + <key>key</key>"
373-
pspg supports a possibility to use a sequence of keys \fBEsc\fR, \fBkey\fR instead an combination of \fBAlt\fR+\fBkey\fR\. The interval between pressing \fBEsc\fR and \fBkey\fR is limmited by interval specified by option \fBesc\-delay\fR or by configuration\'s option \fBesc_delay\fR\. This is max delay time in ms\. After this interval, the single pressing \fBEsc\fR is interpreted as \fBEscape\fR\. \-1 meas unlimited, 0 disables this feature\.
397+
pspg supports a possibility to use a sequence of keys \fBEsc\fR, \fBkey\fR instead an combination of \fBAlt\fR+\fBkey\fR\. The interval between pressing \fBEsc\fR and \fBkey\fR is limited by interval specified by option \fBesc\-delay\fR or by configuration\'s option \fBesc_delay\fR\. This is max delay time in ms\. After this interval, the single pressing \fBEsc\fR is interpreted as \fBEscape\fR\. \-1 meas unlimited, 0 disables this feature\.
374398
.SH "Column search"
375399
Column search is case insensitive every time\. Searched column is marked by vertical cursor\. Last non empty string searching pattern is used when current searching pattern is empty string\. Searching is starting after visible vertical column or on first visible not freezed columns (after some horizontal scrolling) or on first column\. After last column searching starts from first again\.
376400
.SH "Export & Clipboard"
377401
For clipboard support the clipboard application should be installed: 1\. wl\-clipboard (Wayland), 2\. xclip (xwindows) or 3\. pbcopy (MacOS)\.
378402
.P
379403
\fBpspg\fR try to translate unicode symbol \'\' to NULL every time\. If you don\'t use special setting by \fB\epset null \|\.\|\.\|\.\fR, then \fBpsql\fR displays empty string instead NULL\. \fBpspg\fR hasn\'t any special detection (in export routines) for this case\. You should to check and enable or disable menu item \fBEmpty string is NULL\fR\.
380404
.P
381-
\fBpspg\fR has automatic detection of clipboard application\. Unfortunatelly, this detection should not to work for same cases\. You can specify the application by specify number (1,2,3) to \fB\-\-clipboard\-app\fR option\.
405+
\fBpspg\fR has automatic detection of clipboard application\. Unfortunately, this detection should not to work for same cases\. You can specify the application by specify number (1,2,3) to \fB\-\-clipboard\-app\fR option\.
382406
.SH "Status line description"
383407
.IP "\[ci]" 4
384-
\fBV: [d/d d\.\.d]\fR \- vertical cursor: (column number)/(columns) (char possitions from) \.\. (char possitions to)
408+
\fBV: [d/d d\.\.d]\fR \- vertical cursor: (column number)/(columns) (char positions from) \.\. (char positions to)
385409
.IP "\[ci]" 4
386410
\fBFC: d\fR \- freezed columns length in chars
387411
.IP "\[ci]" 4
@@ -432,6 +456,19 @@ The result of query can be refreshed every n seconds\. \fBpspg\fR remembers curs
432456
\fBpspg\fR can read a continuous stream of tabular data from pipe, named pipe or from file (with an option \fB\-\-stream\fR or it can read a stream of queries from pipe or from file (with an option \fB\-\-querystream\fR)\. In stream mode, only data in table format can be processed, because \fBpspg\fR uses empty line as separator between tables\.
433457
.P
434458
The query stream mode is an sequence of SQL statements separated by char GS (Group separator \- 0x1D on separated line\.
459+
.IP "" 4
460+
.nf
461+
pavel@localhost ~]$ cat < /dev/pts/3 > ~/pipe
462+
select 10
463+
^]
464+
select 20
465+
^]
466+
select *
467+
from
468+
pg_class
469+
^]
470+
.fi
471+
.IP "" 0
435472
.SH "Recommended psql configuration"
436473
you should to add to your profile:
437474
.IP "" 4
@@ -534,7 +571,7 @@ Note: \fBfooter_mode\fR should be disabled
534571
.SH "Note \- mouse"
535572
pspg try to use xterm mouse mode 1002, when terminal and ncurses are not too antique\. If there are problems with usage \- unwanted visual artefacts when you move with mouse when some mouse button is pressed, then 1\. please, report issue (please, attach log file), 2\. use an option \fB\-\-no\-xterm\-mouse\-mode\fR and \fBpspg\fR will not try to activate this mode\.
536573
.SH "Note \- true color themes on KDE konsole terminal"
537-
On my Fedora this terminal doesn\'t correctly display true color themes\. The basic problem is in default \fBTERM\fR setting, that is \fBxterm\-256color\fR\. Unfortunately, the \fBkonsole\fR terminal is not fully compatible with \fBxterm\fR, and doesn\'t allow color changing\. You can force direct colors by using the option \fB\-\-direct\-color\fR or by setting \fBTERM=xterm\-direct\fR\. Second option is more corect setting of \fBTERM\fR variable to \fBkonsole\-256color\fR\. In this case the \fBpspg\fR will map the true rgb colors to supported 256 colors\.
574+
On my Fedora this terminal doesn\'t correctly display true color themes\. The basic problem is in default \fBTERM\fR setting, that is \fBxterm\-256color\fR\. Unfortunately, the \fBkonsole\fR terminal is not fully compatible with \fBxterm\fR, and doesn\'t allow color changing\. You can force direct colors by using the option \fB\-\-direct\-color\fR or by setting \fBTERM=xterm\-direct\fR\. Second option is more correct setting of \fBTERM\fR variable to \fBkonsole\-256color\fR\. In this case the \fBpspg\fR will map the true rgb colors to supported 256 colors\.
538575
.SH "Note \- compilation issue"
539576
Some linker issues can be fixed by:
540577
.IP "" 4
@@ -549,36 +586,44 @@ gcc pager\.c \-o pspg \-ggdb \-lncursesw
549586
If you want to use \fBpspg\fR as Postgres client, then you need run \fBconfigure \-\-with\-postgresql=yes\fR\. On Fedora with own Postgres build I had to install \fBopenssl\-devel\fR package and I had to set \fBexport PKG_CONFIG_PATH="/usr/local/pgsql/master/lib/pkgconfig/"\fR\.
550587
.P
551588
On FreeBsd you should to use \fBgmake\fR instead \fBmake\fR\.
552-
.SH "Note \- Installation"
589+
.SH "Note \- Installation details"
553590
When you compile code from source, run \./configure first\. Sometimes \./autogen\.sh first
554591
.P
555592
If you would to display UTF\-8 characters, then \fBpspg\fR should be linked with \fBncursesw\fR library\. UTF\-8 characters are displayed badly when library \fBncursesw\fR is used\. You can see broken characters with incorrect locale setting too\.
556593
.P
557-
You can check wide chars support by \fBpspg \-\-version\fR\. Row \fBncurses with wide char support\fR is expected\. Re\-run \fBconfigure\fR with \fB\-\-with\-ncursesw\fR option\. When this command fails check if development package for ncuresesw library is installed\.
558-
.SH "Homebrew (for Linux & MacOS)"
594+
You can check wide chars support by \fBpspg \-\-version\fR\. Row \fBncurses with wide char support\fR is expected\. Re\-run \fBconfigure\fR with \fB\-\-with\-ncursesw\fR option\. When this command fails check if development package for ncursesw library is installed\.
595+
.SS "Homebrew (for Linux & MacOS)"
559596
.nf
560597
# brew install pspg
561598
.fi
562-
.SH "Debian"
599+
.P
600+
You can compile easily \fBpspg\fR without \fBbrew\fR, but you need \fBgnu readline\fR library\. MacOS uses by default readline emulated over libedit, but \fBpspg\fR requires full gnu readline library\.
601+
.IP "" 4
602+
.nf
603+
LDFLAGS="\-L/usr/local/opt/readline/lib" CPPFLAGS="\-I/usr/local/opt/readline/include" \./configure
604+
LDFLAGS="\-L/usr/local/opt/readline/lib" CPPFLAGS="\-I/usr/local/opt/readline/include" make
605+
.fi
606+
.IP "" 0
607+
.SS "Debian"
563608
.nf
564609
# apt\-cache search pspg
565610
# apt\-get install pspg
566611
.fi
567-
.SH "Fedora (28 and later)"
612+
.SS "Fedora (28 and later)"
568613
.nf
569614
# dnf install pspg
570615
.fi
571-
.SH "RPM (CentOS/openSUSE/…)"
616+
.SS "RPM (CentOS/openSUSE/…)"
572617
The pspg is available from community repository https://yum\.postgresql\.org/packages\.php
573-
.SH "Alpine Linux"
618+
.SS "Alpine Linux"
574619
.nf
575620
# apk add pspg
576621
.fi
577-
.SH "Gentoo"
622+
.SS "Gentoo"
578623
.nf
579624
# emerge \-av dev\-db/pspg
580625
.fi
581-
.SH "Arch Linux"
626+
.SS "Arch Linux"
582627
The Arch User Repository contains two versions:
583628
.IP "\[ci]" 4
584629
pspg \fIhttps://aur\.archlinux\.org/packages/pspg/\fR is a fixed release\.
@@ -587,47 +632,67 @@ pspg\-git \fIhttps://aur\.archlinux\.org/packages/pspg\-git/\fR tracks the \fBma
587632
.IP "" 0
588633
.P
589634
Use the AUR helper of your choice or git and \fBmakepkg\fR to install pspg\.
590-
.SH "FreeBSD"
635+
.SS "FreeBSD"
591636
.nf
592637
# pkg install pspg
593638
.fi
594-
.SH "OpenBSD"
639+
.SS "OpenBSD"
595640
.nf
596641
# pkg_add pspg
597642
.fi
598643
.P
599644
More about it \fIhttps://fluca1978\.github\.io/2021/10/28/pspgOpenBSD\.html\fR
600-
.SH "Using MacPorts (MacOS only)"
645+
.SS "Using MacPorts (MacOS only)"
601646
.nf
602647
# port install pspg
603648
.fi
604-
.SH "Solaris"
649+
.SS "MS Windows"
650+
\fBpspg\fR can be simply used on MS Windows by using wsl2\. I tested it, and it is working without problems\.
651+
.IP "\[ci]" 4
652+
In terminal execute \fBwsl \-\-install \-d Ubuntu\-22\.04\fR
653+
.IP "\[ci]" 4
654+
In terminal open Ubuntu session
655+
.IP "" 0
656+
.P
657+
``` sudo apt\-get update sudo apt\-get install pspg sudo apt\-get install postgresql postgresql\-contribsudo passwd postgres su \- postgres psql postgres » create role pavel login; \eq exit touch ~/\.psqlrc mcedit \.psqlrc \epset linestyle unicode \epset border 2 \esetenv PSQL_PAGER \'pspg \-b \-X\' # press F2 and F10 psql postgres ```
658+
.P
659+
there is not any difference from installation and work on Ubuntu (Debian)
660+
.P
661+
\fBpspg\fR is not ported to MS Windows yet\. There is the dependency on ncurses and correctly (fully) implemented function \fBnewterm\fR (\fBpdcurses\fR does this only on Unix platforms)\. It can work with WSL2 maybe (I didn\'t test it)\. An alternative can be using \fBless\fR pager, that is ported to some MS Win enviroments\. \fBless\fR depends on \fBtermcap\fR, and it is little bit more portable than \fBpspg\fR (\fBtermcal\fR is low layer of ncurses)\. \fBless\fR supports fixed rows and with \fB\-\-chop\-long\-lines\fR option or just \fB\-S\fR can be used as pager for \fBpspg\fR\.
662+
.IP "" 4
663+
.nf
664+
export PSQL_PAGER="less \-\-chop\-long\-lines \-\-header 1"
665+
.fi
666+
.IP "" 0
667+
.SS "Solaris"
605668
There are few issues requires manual code changes for successful compilation \- we successfully tested \fBpspg\fR, but although \fBpspg\fR was linked with ncursesw libraries, the utf8 encoding support didn\'t work fully correctly \- probably due some issues in \fBlibc\fR library\. There are problems with chars encoded to 3bytes \- unicode borders, \.\. Two bytes unicode chars should be displayed well\.
606669
.P
607-
You can use \fBpspg\fR with usual accented chars, but unicode bordes should not be used\. Replacement ascii borders by special borders chars (by ncurses technology) works well \- looks on \fBOptions|Force unicode borders\fR option\.
670+
You can use \fBpspg\fR with usual accented chars, but unicode borders should not be used\. Replacement ascii borders by special borders chars (by ncurses technology) works well \- looks on \fBOptions|Force unicode borders\fR option\.
608671
.IP "\[ci]" 4
609672
Solaris \fBmake\fR doesn\'t support conditional statements \- should be removed So, remove unsupported functionality from \fBMakefile\fR (\fBifdef\fR,\fBendif\fR), replace \fB\-include\fR by \fBinclude\fR first\.
610673
.IP "\[ci]" 4
611-
After running \fBconfigure\fR remove link on \fBtermcap\fR library from \fBconfig\.make\fR\. It is garabage produced by \fBreadline\fR automake script\. Combination with \fBncurses\fR libraries makes some linking issues\.
674+
After running \fBconfigure\fR remove link on \fBtermcap\fR library from \fBconfig\.make\fR\. It is garbage produced by \fBreadline\fR automake script\. Combination with \fBncurses\fR libraries makes some linking issues\.
612675
.IP "" 0
613-
.SS "builtin libraries"
676+
.IP "" 4
614677
.nf
615678
export CURSES_CFLAGS="\-I/usr/include/ncurses/"
616679
export PANEL_LIBS="\-lpanelw"
617680
\&\./configure
618681
.fi
619-
.SS "OpenCSW development"
682+
.IP "" 0
683+
.IP "" 4
620684
.nf
621685
export CFLAGS="\-m64 \-I/opt/csw/include"
622686
export LDFLAGS="\-L/opt/csw/lib/64 \-R/opt/csw/lib/64"
623687
export PKG_CONFIG_PATH="/opt/csw/lib/64/pkgconfig"
624688
\&\./configure
625689
.fi
690+
.IP "" 0
626691
.SH "Possible ToDo"
627692
.IP "\[ci]" 4
628693
Store data in some column format (now data are stored like array of rows)\. With this change can be possible to operate over columns \- hide columns, change width, cyclic iteration over columns, change order of columns, mark columns and export only selected columns (selected rows)\.
629694
.IP "\[ci]" 4
630-
Replace printing document directly to ncurses window by some smarter structure\. Internally there are lot of checks and fixs to support complex dynamic layout\. The possibly views should to remember first row, last row, current row\. Now, these data are in global variables or in DataDesc and ScrDesc structures\.
695+
Replace printing document directly to ncurses window by some smarter structure\. Internally there are lot of checks and fixes to support complex dynamic layout\. The possibly views should to remember first row, last row, current row\. Now, these data are in global variables or in DataDesc and ScrDesc structures\.
631696
.IP "" 0
632697
.SH "st_menu"
633698
This project uses st_menu library \- implementation of CUA menubar and pulldown menu for ncurses https://github\.com/okbob/ncurses\-st\-menu

0 commit comments

Comments
 (0)