-
Notifications
You must be signed in to change notification settings - Fork 135
Description
We had a few PRs implementing this in one or another way, but we never decided which implementation we'd like to stabilize.
See:
If a user specifies the "readonly" option at the client level and tries to execute a query too long to fit in the GET request's query parameters, "readonly" is set twice in the header - once as "1" and again as whatever the user specified. In particular, this means it's not possible to set another value for "readonly" on queries that use the POST method. Bypass setting "readonly" the first time if it's part of the Client's options already.
This PR is meant to improve the control over the readonly option sent by the client to the CH database. Right now, it is defined by some methods like Query::do_execute, but most of the public methods like Query::fetch, Query::fetch_one, or Query::fetch_all don’t have control over this option. This makes it impossible to query the database with queries that contain a lot of columns and require temporary table creation on the database side, which results in the following error:
Code: 164. DB::Exception: db_user: Cannot execute query in readonly mode. (READONLY) (version 24.10.1.2812 (official build))
By adding the changes in this PR, we will gain control over this option, making it possible to request data that requires the creation of temporary tables by CH.
- Always use POST for queries; disable readonly setting by default #184
(and see also: Always use POST for queries; disable readonly setting by default #184 (comment))
Perhaps the least invasive method to fixing it is to a) keep the GET or POST logic as-is, and b) allow overriding readonly
explicitly.
Then we can re-open one of the linked PRs, or re-implement improved logic regarding readonly
option.