I'm currently working on implementing a 2 layer security, meaning we have orm query filtering in our application code as well as in our database. In the database I'm using Postgre Row Level Security.
In an ideal world, all the filtering queries built in the application code is perfect and the row level security policies never remove entries. However, if it does happen to filter out a result, that means that we have an error in our filtering in application code that must be fixed. I would like to be able to log this.
Is it possible to configure Postgresql that I can be notified / log these occurrences?