fix(postgres): detect search_path changes via set_config, not only SET - #43060
fix(postgres): detect search_path changes via set_config, not only SET#43060sha174n wants to merge 2 commits into
Conversation
`PostgresEngineSpec.get_default_schema_for_query` rejects a query that rebinds
the session `search_path`, because a changed search_path alters how unqualified
table references resolve. It previously matched only the structured
`SET search_path = ...` form (via `get_settings`), and missed the equivalent
`set_config('search_path', ...)` function-call form (and other variants).
Switch the guard to `changes_search_path()`, which already recognises the
`SET`, `set_config`, and exotic forms in one place. Adds a regression test for
the `set_config` form.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Code Review Agent Run #240a97Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
|
The flagged security issue is valid. The current implementation in superset/db_engine_specs/postgres.py |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #43060 +/- ##
==========================================
- Coverage 66.55% 66.54% -0.01%
==========================================
Files 2864 2864
Lines 161894 161902 +8
Branches 37305 37308 +3
==========================================
- Hits 107742 107739 -3
- Misses 52106 52116 +10
- Partials 2046 2047 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Resolve the setting name conservatively: a set_config() name built from an expression, and a set_config() call inside a statement the parser leaves opaque, both count as a rebind. Add a script-level changes_search_path() so the engine spec keeps using the SQLScript surface instead of iterating statements itself. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Code Review Agent Run #08d369Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
PostgresEngineSpec.get_default_schema_for_queryrejects a query that rebinds the sessionsearch_path, because a changed search_path alters how unqualified table references resolve. It previously matched only the structuredSET search_path = ...form (viaget_settings), and missed the equivalentset_config('search_path', ...)function-call form (and other variants).This switches the guard to
changes_search_path(), which already recognises theSET,set_config, and exotic forms in one place. Adds a regression test for theset_configform.