pgcat
pgcat copied to clipboard
Provide plugin example that modifies incoming SQL
Is your feature request related to a problem? Please describe.
I want to use a postgresql proxy / bouncer to verify conformity with established rules, log non-conform queries and possibly inject automatic edits. My use case is that I want to enforce the use of a hint /* PROJS(projection_name) */ for some relations. pgcat looks like the best option to fiddle around with performance-wise and architecture-wise.
Describe the solution you'd like I'd like an example plugin that lets me:
- iterate over the relations in a query
- verify if next to them a hint-comment is present that matches the format i expect (in the form of a regex)
- inserts such a hint with a default value if it's not present already
- fetches the pairs
relation => default hint valuein config
Describe alternatives you've considered
- writing the plugin on my own without an example