Skip to content

Commit

Permalink
add comment about 'r' and 'p' relkind
Browse files Browse the repository at this point in the history
Co-authored-by: Ryan Krage <[email protected]>
  • Loading branch information
rkrage and Ryan Krage committed Sep 15, 2023
1 parent bf4407d commit 3d164e2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/pg_ha_migrations/blocking_database_transactions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def self.find_blocking_transactions(minimum_transaction_age = "0 seconds")
l.locktype != 'relation'
OR (
ns.nspname != 'pg_catalog'
AND c.relkind IN ('r', 'p')
AND c.relkind IN ('r', 'p') -- 'r' is a standard table; 'p' is a partition parent
)
)
AND psa.xact_start < clock_timestamp() - ?::interval
Expand Down
2 changes: 1 addition & 1 deletion spec/safe_statements_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def locks_for_table(table, connection:)
JOIN pg_class ON pg_locks.relation = pg_class.oid
JOIN pg_namespace ON pg_class.relnamespace = pg_namespace.oid
WHERE pid IS DISTINCT FROM pg_backend_pid()
AND pg_class.relkind IN ('r', 'p')
AND pg_class.relkind IN ('r', 'p') -- 'r' is a standard table; 'p' is a partition parent
AND pg_class.relname = '#{table}'
AND pg_namespace.nspname = '#{schema}'
SQL
Expand Down

0 comments on commit 3d164e2

Please sign in to comment.