feat: add pgfence-inspired safety lint rules#703
Draft
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Handle BEGIN/COMMIT/ROLLBACK in TransactionState to reset accumulated state across transaction boundaries (prevents false positives) - Table-qualify NOT VALID constraint tracking to avoid false positives when different tables share constraint names - Filter AT_ValidateConstraint from ACCESS EXCLUSIVE lock tracking (it takes SHARE UPDATE EXCLUSIVE) - Remove non-concurrent CREATE INDEX from ACCESS EXCLUSIVE tracking (it takes SHARE lock, not ACCESS EXCLUSIVE) - Expand is_dangerous_lock_stmt to cover DropStmt, TruncateStmt, VacuumStmt, ReindexStmt, RenameStmt, RefreshMatViewStmt - Move is_dangerous_lock_stmt to shared TransactionState method (was duplicated in require_statement_timeout and require_idle_in_transaction_timeout) - Change ban_truncate severity from Warning to Error (irreversible data loss) - Fix ban_alter_enum_add_value messaging: remove incorrect ACCESS EXCLUSIVE claim, note PG12+ instant behavior
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.
TransactionStateto trackstatement_timeout,idle_in_transaction_session_timeout, NOT VALID constraints, and ACCESS EXCLUSIVE table setsChangingColumnTypeto allow safe type widenings (text, varchar without length, numeric without precision)PreferRobustStmtsto coverCREATE TABLE IF NOT EXISTSandDROP TABLE IF EXISTS