Skip to content

[Bug]: binary prepared BETWEEN DML rejects text instead of warning and updating #29502

Closed

Description

@XuPeng-SH

Origin

A separate regression found in the Ubuntu/x86 coverage UT job for #29462, running commit 386c1434232af5ccf153b7c2d23e1240be90d021. Tracked as a follow-up under the maintainer's instruction for lower-severity review findings. Distinct from #29501's scalar ABS / derived SUM errors because this is a binary prepared DML warning and predicate result contract.

Reproduction and exact-base proof

Existing TestIssue27443BinaryPreparedDMLAndAggregate/between prepares:

UPDATE predicate_dst
SET status = 12
WHERE id = 1 AND ? BETWEEN 0 AND 0;

Then it executes the binary prepared statement with string parameter "foo". The established contract is successful execution, warning 1292 (Truncated incorrect DOUBLE value), and status=12 because the nonnumeric string converts to zero in the numeric predicate.

At the PR head, stmt.ExecContext(ctx, "foo") fails before the warning/result checks:

Error 20203 (HY000): invalid argument cast to int, bad value foo

CI log: pkg/tests/issues/issue_27443_test.go:495. I reran the same existing focused test on the exact base b06ff850d4c54af2aeb920136f6e39d6b88f940b with the repository CGo-aware wrapper: TestIssue27443BinaryPreparedDMLAndAggregate/between PASS. The head failure is documented by the linked CI job. This makes it a PR-introduced regression, not a coverage-runner error. The complete pkg/tests/issues package fails for this and the separate CHAR test-oracle error tracked in #29500.

Diagnosis direction

Trace parameter source type through BETWEEN overload selection and the implicit numeric casts in the existing prepared binder. Determine why the query now executes a strict integer cast instead of the prior warning-producing numeric comparison conversion. Do not special-case the test or add a second prepared execution route. Compare BETWEEN, NOT BETWEEN, direct equality and numeric/text/NULL rebinding, preserving warning ownership and DML effects.

Acceptance

  • Existing TestIssue27443BinaryPreparedDMLAndAggregate/between passes unmodified, including warning code/message and final row value.
  • Confirm NOT BETWEEN and the sibling predicate cases remain correct, including no duplicate warnings.
  • Add only the smallest new orthogonal oracle if the existing issue suite does not cover an observed failure mode.
  • Verify current-head behavior and exact-base attribution with the same build mode; no test expectation rewrite without a semantic oracle.

Activity

  1. XuPeng-SH commented on Sep 29, 2026

    @XuPeng-SH
    ContributorAuthor

    Fixed on #29462 at f520258 by routing prepared text-parameter BETWEEN with numeric bounds through the existing binary comparison coercion owner. The unchanged Issue27443 binary prepared DML/aggregate suite now passes, including BETWEEN, NOT BETWEEN, warning 1292, and DML result assertions. The exact base passed before the fix; the previous PR head failed in CI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions