This issue requires an assignee. Since you haven't specified one, we've assigned TestManager as the default assignee for this issue.


Welcome To openGauss Community
Hey @Rourou2285 , thanks for your contribution to the community.
Bot Usage Manual
I'm the Bot here serving you. You can find the instructions on how to interact with me at Here . That means you can comment below every pull request or issue to trigger Bot Commands. You can self-configure the PR merge rules for this repository. For more details, please refer to Here.
Contact Guide
If you have any questions, please contact the SIG: Plugin ,
and any of the maintainers: @CarrotGo, @chendong76, @chenxiaobin19, @congzhou2603, @dodders, @hwworkholic, @jemappellehc, @libiao2024, @muyulinzhong, @quemingjian, @shenzheng4, @shirley_zhengx, @superlchf, @totaj, @wlff234, @wofanzheng, @ywzq1161327784 ,
and any of the committers: @dreamalloc, @huyinghao, @libiao2024, @wangfeihuo, @wmy_ld, @wuyuechuan, @xiong_xjun, @zhangxubo, @zhaojunv3z810 .


This issue requires an assignee. Since you haven't specified one, we've assigned TestManager as the default assignee for this issue.


验证结果:通过(PASS)
测例:SeaORM param_flags 模块(examples 测例链接 https://atomgit.com/opengauss/examples/merge_requests/115)
| 用例 | 覆盖 | 结果 |
|---|---|---|
| PF1 | BOOLEAN 绑定 true → 1 |
PASS |
| PF2 | BOOLEAN 绑定 false → 0 |
PASS |
| PF3 | BIGINT/INT/SMALLINT/TINYINT UNSIGNED 最大值 |
PASS |
| PF4 | signed INT 参数对照 | PASS |
| PF6 | WHERE 中的无符号参数 |
PASS |
| PF7 | 标志不变性:同值带/不带 UNSIGNED 标志绑定结果相等 |
PASS |
| PF8 | 无符号零值(带标志的 0 不为 NULL) | PASS |
| PF9 | 带标志参数的 NULL | PASS |
| PF10 | 带标志参数出现在 UPDATE SET / WHERE |
PASS |
| PF11 | 同一语句混用不同宽度的带标志参数 | PASS |
| PF12 | BOOLEAN 参数出现在 WHERE 谓词中 |
PASS |
(PF5 为 BLOB 参数往返,属另一独立问题,与本 issue 无关。)


单独按照issue构建测试用例,pass

使用测试用例:SeaORM param_flags 模块,11个通过,其中PF5非该issue,符合描述预期



问题描述
使用 SeaORM(底层为 SQLx 0.8 MySQL 驱动)通过 prepared statement 插入
BOOLEAN字段并绑定true时,落库结果为NULL,而非true。复现方式
use sea_orm::{ActiveModelTrait, Set}; let st = sea_type::ActiveModel { bool_val: Set(true), ..Default::default() }; st.insert(db).await?; // 读取后 loaded.bool_val == None(NULL),期望为 trueSeaORM 将
bool绑定为参数类型TINY,并声明UNSIGNED标志,因此 16 位参数类型字段为0x8001(低字节 = 类型 TINY=1,高字节 = flag 0x80)。根因
COM_STMT_EXECUTE参数类型字段按协议为 16 位:低 8 位是类型,高 8 位是标志(UNSIGNED/BINARY/BLOB等)。dolphin 的make_stmt_parameters_bytype()用完整 16 位值直接和DOLPHIN_TYPE_*常量比较,导致高字节标志使比较失败,参数类型分派落入default(参数type保持初始值 0),值未被正确解析,最终存为NULL。修复
contrib/dolphin/plugin_protocol/dqformat.cpp的make_stmt_parameters_bytype():- switch (stmt_param->itypes[i]) { + switch (stmt_param->itypes[i] & 0xff) {只比较低 8 位类型,正确忽略高 8 位标志。对所有
DOLPHIN_TYPE_*(1~255,均 ≤255)无损;同时修复带UNSIGNED标志的整数等参数。验证
BOOLEAN绑定true存储为NULL。结论
原实现未剥离参数类型字段的高位标志即参与比较,属协议边界错误(正确性缺陷),对无标志参数无影响,对带标志参数(含 bool)修复。
关联 MR:基于
seaorm-fix-prep-mask分支提交。