From: Mitar <mmitar@gmail.com>
> On Thu, Dec 20, 2018 at 12:07 PM Rob Sargent <robjsargent@gmail.com> wrote:
> > Are you hoping to see the difference in the returned values for successive calls to the same query?
>
> i would like to in as close to real-time as possible get notification when results of a query would have changed if I
woulddo the same query again, without me having to do polling or without me having to do diffing.
Hmm, I guess I could see that as long as the DB wasn't too [write] busy, else you'd be flooded with notifications.
Some years ago when I was working on a web app in Perl (which uses the DBI module for all communication to the DB), I
subclassedDBI in order to see all calls to the DB. For most statements, I just let all the calls go thru. But for
inserts,I wrote to a file the data that was being inserted; for deletes I wrote what was being deleted; and for updates
Iwrote the before and after values. (For the last 2 I changed the delete/update into a select to get the data.) It made
itmuch easier to see how data changed -- especially when I was new to the app.
You could do something like that, where you have an interceptor that reports on data changes, filtering/searching for
justthe parts you want as you see fit. Of course, that would be just for your app, it wouldn't catch changes made from
psqland other tools.
Maybe it's a useful idea for you ... or maybe not. 😊
If you had to have all statements no matter what tool was used to change data, I'd probably change log_statements to
"all","tail -f" the Pg log, and "do the right thing" (which could be non-trivial).
Kevin
This e-mail transmission, and any documents, files or previous e-mail messages attached to it, may contain confidential
information.If you are not the intended recipient, or a person responsible for delivering it to the intended recipient,
youare hereby notified that any disclosure, distribution, review, copy or use of any of the information contained in or
attachedto this message is STRICTLY PROHIBITED. If you have received this transmission in error, please immediately
notifyus by reply e-mail, and destroy the original transmission and its attachments without reading them or saving them
todisk. Thank you.