fix: forward unknown settings for CHANGEABLE_IN_READONLY (#530) - #889
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
…-readonly-custom-settings # Conflicts: # CHANGELOG.md # docs/additional-options.mdx
|
Hey thanks @sankalpsthakur! This is good. I kept the core approach. It makes sense, as kinda discussed in #530 that the client can't discover
|
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