by twelve40 · 9y ago · 0 comments
A NOTIFY SQL command can be sent out from either a stored procedure or a table trigger. (The docs could use some examples of this, but that's the idea.)
I would instead have the trigger insert a row into a "pending tasks" table - and then send a NOTIFY.
It uses the logical decoding feature to get all row changes and writes them to a Kafka queue.
This means it can pick up where it left when it crashes.
That said, you could add event handling inside of Postgresql via triggers and one of the supported procedural languages (like PL/Python)
Not as simple as Parse, I guess, but that's a tradeoff of using lower-level technology.