pgcat icon indicating copy to clipboard operation
pgcat copied to clipboard

Provide plugin example that modifies incoming SQL

Open matchaxnb opened this issue 1 year ago • 0 comments

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 value in config

Describe alternatives you've considered

  • writing the plugin on my own without an example

matchaxnb avatar Dec 06 '24 09:12 matchaxnb