Detect object ownership drift#291
Draft
dilame wants to merge 1 commit into
Draft
Conversation
Track role ownership for supported schema objects so plan generation emits ALTER ... OWNER TO instead of accepting ownership drift silently. Constraint: production drift checks need declarative owner alignment rather than manual repair SQL after migration planning. Rejected: fixing only table owners | functions, procedures, enum types, sequences, views, and materialized views have the same drift failure mode. Confidence: high Scope-risk: moderate Directive: create-time owner DDL should remain explicit because the migration execution role may not be the target object owner. Tested: PATH=/Applications/Postgres.app/Contents/Versions/16/bin:/opt/local/bin:/opt/local/sbin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/usr/local/go/bin:/Users/bowzee/.volta/bin:/Users/bowzee/.codex/tmp/arg0/codex-arg092ZG6R:/opt/homebrew/share/google-cloud-sdk/bin:/Users/bowzee/perl5/bin:/Users/bowzee/.antigravity/antigravity/bin:/opt/homebrew/opt/libpq/bin:/Users/bowzee/.local/bin:/opt/local/bin:/opt/local/sbin:/Users/bowzee/.cargo/bin:/Users/bowzee/Library/Application Support/JetBrains/Toolbox/scripts:/Applications/Codex.app/Contents/Resources go test ./... -count=1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ALTER ... OWNER TO ...for owner drift, with authz hazards on owner changes.Root Cause
pg-schema-diffdid not include object owners in its schema model, so source/target ownership drift could survive an otherwise clean migration plan.Validation
PATH=/Applications/Postgres.app/Contents/Versions/16/bin:$PATH go test ./... -count=1