Skip to content

An option to disable readonly on a query using POST #230

@slvrtrn

Description

@slvrtrn

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.

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.

CC @serprex @loyd

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions