News for hackers. Stuff that matters.
Re:Protecting reserved roles with PostgreSQL Hooks by rad_gruchalski on Friday July 02, 2021 @06:23PM (#27717666)
Not a 100% technically correct answer most likely but first look suggests they hook into the statement preprocessing pipeline. In the example, they’re hooking into the ALTER ROLE statement and deny execution if the role is a protected one. I don’t think this can be done with triggers without creating triggers on system tables and knowing the exact places where postgres would try to make changes. This seems to be an ott solution and probably a pretty bulletproof one.

Very timely article, I wonder if this works with yugabyte...

Re:Protecting reserved roles with PostgreSQL Hooks by steve-chavez on Friday July 02, 2021 @07:22PM (#27718055)
> I wonder if this works with yugabyte

It should work too!

Check this line here[1]. That shows that Yugabyte also has the `ProcessUtility_hook`(same one used in the article) defined. It would be a matter of installing and loading the Supautils extension.

[1]: https://github.com/yugabyte/yugabyte-db/blob/master/src/post...

Re:Protecting reserved roles with PostgreSQL Hooks by rad_gruchalski on Friday July 02, 2021 @08:29PM (#27718369)
I’ll give it a shot over the weekend as I have a few use cases for similar functionality in Yugabyte. This is pretty exciting stuff at the right time!