PostgreSQL alerts to C++ application
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 chan开发者_StackOverflowged.
Thanks, Gtk
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.
I would write C triggers to receive change information.
精彩评论