\o command in psql and psql watch mode is supported too.Example:
#create named pipe mkfifo ~/pipe #use psql [pavel@nemesis ~]$ psql psql (13devel) Type "help" for help. postgres=# \o ~/pokus postgres=# select * from obce limit 10; postgres=# --redirect content to pipe postgres=# \o ~/pipe postgres=# select current_timestamp; postgres=# -- repeat it every 1sec postgres=# \watch 1
In other terminal - run
pspg and read from pipepspg -f ~/pipe
By default
pspg is ending when writer program is closed. This behave can be changed with option --hold-stream to 1 (reopen) or 2 (nonstop opened).
No comments:
Post a Comment