fix: forward unknown settings for CHANGEABLE_IN_READONLY (#530)#889
Open
sankalpsthakur wants to merge 2 commits into
Open
fix: forward unknown settings for CHANGEABLE_IN_READONLY (#530)#889sankalpsthakur wants to merge 2 commits into
sankalpsthakur wants to merge 2 commits into
Conversation
Settings that are not present in system.settings for the current user (for example custom settings declared CHANGEABLE_IN_READONLY on a role) are now sent to ClickHouse instead of raising ProgrammingError. The client cannot reliably discover those settings without extra privileges, so the server is treated as authoritative. Known readonly settings still honor invalid_setting_action. Fixes ClickHouse#530
sankalpsthakur
requested review from
joe-clickhouse and
peter-leonov-ch
as code owners
July 22, 2026 13:30
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
Fixes #530
Custom settings declared
CHANGEABLE_IN_READONLYon a role (for exampleSQL_RO_my_rls_keyused with row policies /getSetting) are often absent fromsystem.settingsfor the restricted user. The client previously treated any missing or readonly setting as invalid and raised:when the same setting was passed via
query(..., settings={...}). Embedding the setting in the SQLSETTINGSclause worked, because that path never goes through client validation.This change forwards settings that are not present in
system.settingsfor the current user to ClickHouse and lets the server accept or reject them. Known readonly settings still honorinvalid_setting_action(error/drop/send).This matches the maintainer suggestion on #530 that fine-grained discovery of
CHANGEABLE_IN_READONLYis not practical for the client without extra privileges.Test plan
tests/unit_tests/test_driver/test_validate_settings.pycovering unknown custom settings, known writable, known readonly (error/drop/send), matching readonly skip, optional transport drop, and transport pass-through. Confirmed the main unknown-setting case fails under the previous validation logic and passes with this change.test_changeable_in_readonly_custom_settingreproduces the issue setup (role withCHANGEABLE_IN_READONLY, readonly user, row policy) for both sync and async clients viaparam_client/call. Skips when the server lacksSQL_custom settings or when running against cloud.ruff check/ruff formaton touched filescustom_settings_prefixes=SQL_, as in this repo's docker-compose config)Checklist