Skip to content

getClientHTTPHeader: mark as non-deterministic - #102766

Closed
SAY-5 wants to merge 1 commit into
ClickHouse:masterfrom
SAY-5:fix-getclienthttpheader-determinism
Closed

SAY-5 wants to merge 1 commit into
ClickHouse:masterfrom
SAY-5:fix-getclienthttpheader-determinism

Conversation

@SAY-5

@SAY-5 SAY-5 commented Apr 15, 2026

Copy link
Copy Markdown

Closes #101120.

FunctionGetClientHTTPHeader (src/Functions/getClientHTTPHeader.cpp) was missing the isDeterministic() const override { return false; } declaration, so the optimizer and the query cache treated it as a pure function. SELECT getClientHTTPHeader('X-Test') SETTINGS use_query_cache=1 was silently cached, and subsequent requests with different HTTP headers read the stale value instead of the current header.

This is the same correctness hazard #92174 fixed for connectionId() (src/Functions/connectionId.cpp:20). Mirror that override here.

Verified against current master.

FunctionGetClientHTTPHeader was missing the isDeterministic() override,
so the optimizer and the query cache treated it as a pure function.
SELECT getClientHTTPHeader('X-Test') SETTINGS use_query_cache=1 was
silently cached, and subsequent requests with different HTTP headers
read the stale cached value instead of the current header — a similar
correctness hazard that #92174 fixed for connectionId().

Mirror connectionId.cpp and add the override here.
@CLAassistant

CLAassistant commented Apr 15, 2026 •

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


SAY-5 seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

alexey-milovidov added a commit to matanper/ClickHouse that referenced this pull request Jun 24, 2026
getClientHTTPHeader reads per-request HTTP headers but inherited the default
isDeterministic() == true, so the query result cache could reuse a stale value
for a later request. Other runtime-dependent functions (queryID, currentDatabase,
connectionId, initialQueryID) already override isDeterministic to return false.

Closes: ClickHouse#101120
Related: ClickHouse#102766

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
getClientHTTPHeader reads per-request HTTP headers but inherited the default
isDeterministic() == true, so the query result cache could reuse a stale value
for a later request. Other runtime-dependent functions (queryID, currentDatabase,
connectionId, initialQueryID) already override isDeterministic to return false.

Closes: ClickHouse#101120
Related: ClickHouse#102766

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

getClientHTTPHeader missing isDeterministic()=false override, same bug class as connectionId()

3 participants