Skip to content

run_process_utility_hook is tangled everywhere, making logic hard to follow and properly review PRs #79

Open
@steve-chavez

Description

@steve-chavez

Problem

Right now the different modules logic are tangled per statement and the standard hook (run_process_utility_hook) is scattered everywhere. This makes it hard to:

Solution

Refactor the codebase so each module has a single entrypoint and the standard hook is always invoked in one single place. Basically:

static void
supautils_hook(PROCESS_UTILITY_PARAMS)
{
  Node   *utility_stmt = pstmt->utilityStmt;
  ret1 = privileged_role_setup(utility_stmt)
  ret2 = reserved_roles_setup(utility_stmt)
  ret3 = privileged_extensions_setup(utility_stmt)
  ret4 = constrained_extensions_setup(utility_stmt)
  
  run_process_utility_hook(prev_hook);

  cleanup(ret1, ret2, ret3, ret4); // or have multiple cleanups depending on the module

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions