Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: execute event triggers under superuser #115

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

steve-chavez
Copy link
Member

Closes #110.

superuser evtrigs now work as usual with the exception of CREATE EXTENSION. Which will now fire superuser evtrigs, but not regular user evtrigs.

This is because how CREATE EXTENSION works under supautils (switchs to superuser before executing CREATE EXTENSION).

Closes supabase#110.

superuser evtrigs now work as usual with the exception of `CREATE EXTENSION`. Which will now fire superuser evtrigs, but not regular user evtrigs.

This is because how `CREATE EXTENSION` works under supautils (switchs to superuser before executing CREATE EXTENSION).
@coveralls
Copy link

Pull Request Test Coverage Report for Build 13465900268

Details

  • 40 of 42 (95.24%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.2%) to 87.047%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/event_triggers.c 27 29 93.1%
Totals Coverage Status
Change from base Build 13426439732: 0.2%
Covered Lines: 961
Relevant Lines: 1104

💛 - Coveralls

@steve-chavez steve-chavez marked this pull request as ready for review February 21, 2025 22:23

if(!current_user_is_super && function_is_owned_by_super){
ereport(ERROR, (
errmsg("supautils requires a non-superuser event trigger to execute a non-superuser owned function")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: users shouldn't need to know what "supautils" is

Suggested change
errmsg("supautils requires a non-superuser event trigger to execute a non-superuser owned function")
errmsg("Non-superuser owned event trigger must execute a non-superuser owned function")


if(current_user_is_super && !function_is_owned_by_super){
ereport(ERROR, (
errmsg("supautils requires a superuser event trigger to execute a superuser owned function")
Copy link
Member

@soedirgo soedirgo Feb 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
errmsg("supautils requires a superuser event trigger to execute a superuser owned function")
errmsg("Superuser owned event trigger must execute a superuser owned function")

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Execute event trigger under superuser
3 participants