The scenario is that we have a large Postgres table. Can a solution be designed to create a table with constraint specifications and filter in all records meeting specifications and producing reports (e.g., on problematic ones)?
Regarding your second question, I think you just want to write some stored procedures -- the cool thing about Pg is you can write them in almost any language you can think of, but I believe writing them in SQL is the easiest and with the most support/examples online: