Closed Napam closed 7 months ago
pspg
supports inotify by default - so when you change the file, then the pspg should to do refresh
I tested
pavel@nemesis:~/src/pspg-master/src$ psql -c "select * from pg_class" > ~/o.dat
pavel@nemesis:~/src/pspg-master/src$ psql -c "select * from pg_class limit 10" > ~/o.dat
pavel@nemesis:~/src/pspg-master/src$ psql -c "select * from pg_class limit 20" > ~/o.dat
and in separate terminal just pspg -f ~/o.dat
and it is working
--watch
option is necessary only when inotify API is not available or doesn't work
Maybe you should to look on https://github.com/okbob/pspg#streaming-modes
Oh ok! I guess you already had it covered. I am on an apple silicon mac, so unfortunately neither linux or inotify isn't easily available for me as far as I know :(
I tried using the streaming mode (not query stream), but it didn't behave that well in my case. Or rather, it behaved perfectly as it should for its use case (streaming). So it worked perfectly when I used psql
interactively, but it didn't really work when doing what I did with using a file watcher (entr) which wrote to the output file.
As I understand it, query streams is for a the "REPL"-like behavior, correct? While I would rather just write some sql in a file, then execute it on save.
Also: after testing around more with my current setup with running the entr file watcher in the background and such made everything using curses (e.g. htop, pspg) really laggy and buggy during interaction (like scrolling up and down).
I guess this feature request isn't really that essential nor urgent for me after all as I have other way worse issues 😅 .
pspg
should to support KQUEUE, that is used by MacOS too. Unfortunately, Apple is strange - see, all reported issues are related to Apple. It is compatible just with self. And I have not this comp, so I cannot to test all special behaviour. I tested pspg
against FreeBSD, but some API on Apple are legacy or modified and in some details works differently.
Ah I see, thats very unfortunate. Anyways, thank you very much for your support and quick response! I'll mark this issue as closed.
Except for my little problem, the programs works very well on my mac.
Hi, thank you very much for pspg, it is a very nice and useful tool.
I see in the code that
watch_time
is an integer, which you multiply by 1000 to get seconds, meaning the fastest watch time I can get is 1 second. Would it be possible to use floats instead such one can say something like 0.5 seconds to achieve even faster watch times?My use case is the following:
based on inotify(entr) which runs something likepsql ...options.... -o --file sql_file.sql -o output
when the file gets saved (this runs in the background)pspg
watch theoutput
fileEdit:
An arguably better thing for my case is to just watch the
output
file for changes, then reload when needed. Or even let it watch a sql file, and then pspg will execute and reload the output itself.Edit 2: Correction: the file watcher I am using does have inotify support like pspg, but its kinda irrelevant for me as i am on a mac