tags:

views:

33

answers:

2

Hi Folks,

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

A: 

I would write C triggers to receive change information.

Peter G.
A: 

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.

a_horse_with_no_name