Skip to content

Conversation

sniek-ie
Copy link

What

Detect typed parameter placeholders ({name:Type}) against the original SQL (before degenerations),
so JSON data injected during degenerations does not erroneously trigger URL param_*.

Why

When JSON contains strings like "{foo:bar}", the current regex runs on the mutated SQL and
thinks we use typed placeholders, causing all simple bindings (:non-typed-binding) to be appended to the URL. With large INSERT batches
this creates extremely long URLs (e.g. >10 MB) and leads to cURL errors like "No URL set!" or "Out of memory".

How

  • Add originalSQL to Query and run isUseInUrlBindingsParams() against it.
  • Keep existing behavior for real typed placeholders.

Backward compatibility

  • No breaking changes: fall back on previous behaviour when custom Degenerations are detected to avoid failure when a custom degeneration class adds typed parameter placeholders to the sql

Tests

  • Added tests for Query (ClickHouseDB\Tests\Query::testIsUseInUrlBindingsParamsWithSimilarPatternInValue reproduces the issue)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant