Reputation: 129
My C++ application has to receive alerts from the PostgreSQL database, as soon as any data is modified in tables. Can you please advice to implement this in best possible way.
Please note that alert information would also need to have the information of the data that has been changed.
Thanks, Gtk
Upvotes: 1
Views: 435
Reputation:
Write a regular pl/pgSQL trigger that sends a NOTIFY when something changes
In your program you can use LISTEN to receive the messages.
The only drawback is, that you need to poll from within your application in regular intervals in order to receive the messages
In 8.x the message sent around could not carry any payload. In 9.0 you can send additional information with the message.
Upvotes: 1