Skip to content

[Bug]: UPDATE IGNORE invalid conversions error instead of updating adjusted values #25365

Closed

Description

@Ariznawlll

MatrixOne version

latest main tested locally: 0e8602b78

MySQL version

MySQL 8.0.45

Steps to Reproduce

drop database if exists mysql_compat_model1_gap;
create database mysql_compat_model1_gap;
use mysql_compat_model1_gap;

set session sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_DATE,NO_ZERO_IN_DATE';
create table t_update_ignore(id int primary key, i int, d decimal(5,2), dt date, vc varchar(4));
insert into t_update_ignore values (1,1,1.23,'2024-01-01','ok');

update ignore t_update_ignore
set i='abc', d='99999.99', dt='2024-02-31', vc='abcdef'
where id=1;

select id, i, d, dt, vc, hex(vc) from t_update_ignore;

Expected Behavior

MySQL downgrades the invalid assignments to warnings and updates the row with adjusted values:

id  i  d       dt          vc    hex(vc)
1   0  999.99  0000-00-00  abcd  61626364

Actual Behavior

MatrixOne errors and leaves the original row unchanged:

ERROR 20203: invalid argument cast to int, bad value abc

id  i  d     dt          vc  hex(vc)
1   1  1.23  2024-01-01  ok  6F6B

Notes

This is not the same as #25347. #25347 tracks UPDATE IGNORE duplicate-key conflict handling; this issue tracks invalid value conversion / adjustment semantics in UPDATE IGNORE.

Activity

  1. added
    kind/bug
    severity/s1
    on Jul 2, 2026
  2. added this to the MO-202607 milestone on Jul 2, 2026
  3. added theissue type on Jul 2, 2026
  4. added and removed
    severity/s1
    on Jul 2, 2026
  5. LeftHandCold commented on Jul 3, 2026

    @LeftHandCold
    Collaborator

    Checked this while preparing the focused fix for #25352.

    I am not including #25365 in that PR because UPDATE IGNORE is not a low-risk compatibility tweak in the current code path. A correct implementation first needs statement-level IGNORE semantics to be preserved through parsing/planning/execution, then each affected error class must be deliberately downgraded or adjusted.

    The cases in this issue are also part of the same broader invalid-value adjustment area as #25364: invalid numeric strings, invalid dates, decimal overflow/saturation, warnings, and strict-vs-non-strict behavior. Changing those paths would affect normal UPDATE, UPDATE IGNORE, prepared statements, generated/default expressions, and shared assignment cast behavior. Earlier discussion in #15345 also records that some MySQL invalid-value behavior under IGNORE should not be copied without an explicit MO product decision.

    Given that, I do not think this should be fixed as part of #25352. The safer path is to first decide the intended MO compatibility policy for invalid adjusted values, then implement UPDATE IGNORE consistently across the parser, planner, and execution error handling.

  6. Ariznawlll commented on Jul 3, 2026

    @Ariznawlll
    CollaboratorAuthor

    Reviewed the R&D comment and I agree this should not be treated as a small standalone bug fix.

    UPDATE IGNORE invalid-value handling needs a deliberate statement-level IGNORE policy across parser/planner/execution, plus a product decision for which conversion failures should be downgraded to warnings and which adjusted values should be written. The repro is in the same invalid adjusted-value semantic family as #25364: invalid numeric strings, invalid dates, decimal saturation, warnings, and strict-vs-non-strict behavior.

    Changing this only for this issue would risk inconsistent behavior between UPDATE, UPDATE IGNORE, prepared statements, defaults/generated expressions, and shared assignment casts.

    For future exploration, I will not file UPDATE IGNORE invalid adjusted-value differences as new MySQL-compat bugs unless MO explicitly decides to follow this MySQL behavior.

    Closing this issue as not planned/current behavior pending product decision.

  7. Ariznawlll commented on Jul 3, 2026

    @Ariznawlll
    CollaboratorAuthor

    Reopening: my previous close was premature.

    After re-reading the R&D comment, this is not confirmed as "not a bug". The comment means UPDATE IGNORE invalid-value adjustment is a broad semantic/product decision, not something that should be fixed opportunistically in the #25352 path.

    Under MySQL compatibility expectations, the behavior still differs from MySQL. Whether MO should implement MySQL-style UPDATE IGNORE adjusted values and warning downgrades needs explicit product/R&D confirmation, so this should remain open/needs-triage.

  8. LeftHandCold commented on Jul 15, 2026

    @LeftHandCold
    Collaborator

    I rechecked the reproductions against current main (ea7b57f104). The compatibility difference is real, but the conclusion is unchanged: this is not a safe small UPDATE IGNORE patch.

    Current main preserves UPDATE IGNORE for duplicate-key handling through the plan/execution path, but invalid numeric/date/decimal conversions happen in shared assignment casts before that duplicate-key policy. Extending IGNORE from the currently explicit cases to adjusted conversion values and warnings would affect update, insert, load, prepared statements, defaults, and generated expressions.

    This is the same unresolved product-semantics question as #25364 and the maintainer direction recorded in #15345. A local update-only exception would make equivalent assignments behave differently depending on the statement path.

    Conclusion: no PR for this issue as currently scoped. If MatrixOne decides to adopt MySQL-style adjusted-value behavior, it should first define one conversion/warning policy and apply it consistently to all assignment paths.

  9. LeftHandCold commented on Jul 31, 2026

    @LeftHandCold
    Collaborator

    #25365:MySQL 明确规定 UPDATE IGNORE 将转换错误调整到最近合法值,因此不是“MySQL 自己也错了”。MySQL UPDATE 文档 (https://dev.mysql.com/doc/refman/8.0/en/update.html) 当前 main 已修复 VARCHAR 截断和重复键,但
    integer、decimal、date 仍不同。由于 #15345 已有 maintainer 结论“不跟随类型不匹配、越界等宽松行为”,现在不应做 UPDATE-only 局部补丁;除非产品重新决定统一兼容 INSERT/UPDATE/LOAD/prepared 及 warning 语义。

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

Metadata

Metadata

Assignees

Labels

kind/bug

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions