Repository navigation
fix: use a derived query ID for insert schema lookups - #481
Merged
abonander merged 3 commits intoOct 6, 2026
Merged
Conversation
hsdfat
requested review from
abonander,
joe-clickhouse,
kavirajk and
peter-leonov-ch
as code owners
September 27, 2026 03:11
Contributor
|
@hsdfat I cannot merge your PRs unless you sign the CLA as shown above. |
abonander
requested changes
Oct 1, 2026
Contributor
Author
The DESCRIBE TABLE issued to fetch the schema before an insert inherited all client settings, including query_id, so the same id was used for both the DESCRIBE and the INSERT. Drop query_id from that query only; session_id and other settings are kept. Fixes ClickHouse#477
Signed-off-by: phatlc <phatle.hsd@gmail.com>
hsdfat
force-pushed
the
metadata-query-without-query-id
branch
from
October 2, 2026 17:12
c0eb2e7 to
830b586
Compare
abonander
approved these changes
Oct 6, 2026
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 #477
When insert validation fetches a table schema, its internal
DESCRIBE TABLEinherits the client'squery_id. Reusing that ID for the subsequentINSERTmakes the query log ambiguous and can triggerQUERY_WITH_SAME_ID_IS_ALREADY_RUNNING.The schema lookup now uses
{query_id}-describe, preserving its link to the originalINSERTwhile assigning the two requests distinct IDs. TheINSERTretains the caller's ID.session_idand all other settings are preserved, and absent or empty IDs retain server-generated ID behavior. This also coversInserter.Unit tests verify derived IDs, preserved client/session settings, and absent/empty IDs. Integration tests inspect
system.query_logand assert that the linked ID belongs toDescribeand the original ID belongs toInsert, for both direct inserts andInserter.Validation after rebasing onto current
main:cargo test --lib --all-features: 109 passed.cargo test --test it --all-features insert -- --test-threads=2: 40 passed against ClickHouse 26.9.3.38, including temporary-table/session tests and both regressions.cargo clippy --all-targets --all-features -- -D warningscargo clippy --all-targets --no-default-features -- -D warningscargo fmt --all -- --checkChecklist