I have written a warehouse management web app. The application handles batch picking, warehouse routing, packing, and the final piece is handled by UPS worldship to ship the packages. Worldship will write a record to my postgres db after every shipment or void. I need a way to cleanly see that the record was written/deleted and then do stuff.The easy answer is to have a program just monitor the database and when it sees a record written to do its thing but something is nagging at me that there is probably a better way to go about this that doesn't have a program polling the table and comparing it to what was there last.EDIT: How i was going to approach this...The table is setup with a status field. My program would on intervals read the table for any records that have a null status, if records are found do stuff then mark the status as complete.TIA
How to handle manipulation of data after a db record is written from outside my program
programming languages;postgres
There's at least two other effective means to handle this type of problem.A. Use triggers.  Set them to fire on the appropriate operations.B. Expose a service.  The client program goes through the service instead of directly hooking into the database.  This gives you full control over which tables can be updated.  The extra layer gives you the ability to handle operations in an imperative language as well.  In other words, C#/Java is usually a better choice for item manipulation such as iterating individual rows as opposed to SQL which is best suited for set operations.