0

I need to calculate a value for each row in my database. The calculation is quite involved, requiring lookup tables and parameters that are stored in the database too.

Now I know I can write an app, connect to the server, and calculate the value for each row - which is what I am doing now.

But is it also possible to do it the other way round? Namely, have the postgresql server pass the required info to a console app and receive the value to store? In which case you could have PostgreSQL automatically calculate the value each time a new row is inserted.

1 Answers1

0

For This, We can use the NOTIFY and LISTEN commands in Postgres. This allows notifications to be sent to clients who are Listening and are connected to the database. So you can create a channel in your application for listening and create a trigger on insert and notify the value and the client in this case the console app to do something.

This is a good article I found how we can do this you can refer to it here

Sathiraumesh
  • 5,949
  • 1
  • 12
  • 11