Repository navigation
test: scope the carried-policy lookup to the test's own table - #836
Merged
Merged
Conversation
`retyped_by_hand` read `pg_policy` by policy name alone. Every Postgres test runs in its own schema, and under xdist two tests can hold a `transaction` table with `rls_transaction_direction` at the same moment, so the lookup saw two rows and `[(using,)] = policies` failed with "too many values to unpack". The attrdef query beside it was already scoped through `regclass`; the policy query now is too. Seen on PR #832's Postgres shards; main's run had passed on timing alone. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
tests/test_generate_generated_columns.py::test_drift_says_nothing_of_a_policy_carried_around_a_replace[postgres]failed on both Postgres shards of PR #832's CI withValueError: too many values to unpack (expected 1, got 2)at the[(using,)] = policiesline.Why: the
retyped_by_handhelper readspg_policyby policy name with no table filter. Every Postgres test runs in its own schema, so under xdist two tests can hold atransactiontable carryingrls_transaction_directionat the same moment, and the lookup returns both. Thepg_attrdefquery right above it was already scoped through'"transaction"'::regclass; main's run on cf1ee43 passed on timing alone.Fix:
WHERE polrelid = '"transaction"'::regclass AND polname = ..., the same scoping the neighbouring query uses. No other unscopedpg_policyread exists intests/.Verify:
uv run --no-sync pytest tests/test_generate_generated_columns.py -k "carried or retyped or policy" --db-backends=postgres -q→ 5 passed on Postgres 18.🤖 Generated with Claude Code