Skip to content

feat: grant REINDEX capability to analytics user in read-write mode#15

Merged
passcod merged 2 commits intomainfrom
feat/analytics-reindex
Mar 11, 2026
Merged

feat: grant REINDEX capability to analytics user in read-write mode#15
passcod merged 2 commits intomainfrom
feat/analytics-reindex

Conversation

@passcod
Copy link
Member

@passcod passcod commented Mar 11, 2026

Grant the analytics user the ability to run REINDEX commands when readOnly: false.

Changes to privilege model:

PG version read_only Privileges
< 14 any superuser (unchanged)
14-16 true pg_read_all_data (unchanged)
14-16 false superuser (was: pg_write_all_data + CREATE ON DATABASE)
17+ true pg_read_all_data (unchanged)
17+ false pg_read_all_data + pg_write_all_data + pg_maintain + CREATE ON DATABASE (new: pg_maintain)

PG 14-16 read-write is promoted to superuser because pg_maintain was only introduced in PG 17. This matches the existing PG < 14 behavior.

Testing: Added a REINDEX TABLE assertion to the existing analytics_create_schema_read_write integration test.


🦸 Review Hero

  • Run Review Hero
  • Auto-fix review suggestions
  • Auto-fix CI failures

- PG < 16 read-write: use superuser (pg_maintain doesn't exist)
- PG >= 16 read-write: grant pg_maintain for REINDEX/VACUUM/ANALYZE
- PG >= 14 read-only: unchanged (pg_read_all_data only)
- PG < 14: unchanged (superuser)
@passcod passcod force-pushed the feat/analytics-reindex branch from 5d745ef to 35df1b5 Compare March 11, 2026 01:52
@review-hero
Copy link

review-hero bot commented Mar 11, 2026

🦸 Review Hero Summary
3 agents reviewed this PR | 1 critical | 3 suggestions | 0 nitpicks

@review-hero
Copy link

review-hero bot commented Mar 11, 2026

🦸 Review Hero Auto-Fix
Applied fixes for 3 review comments.

View logs

@review-hero
Copy link

review-hero bot commented Mar 11, 2026

🦸 Review Hero Summary
2 agents reviewed this PR | 0 critical | 0 suggestions | 0 nitpicks

No issues found. Looks good! ✅

@passcod passcod merged commit d42116b into main Mar 11, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant