[jooq] Add DELETE LIMIT emulation via subquery
@Naifff 已经在做这个了。
开始于 2026年10月9日。
评估
调研方向
从 YdbDSLContextImpl.deleteQuery() 和 org.jooq.impl 中现有的 UpsertReplaceQueryImpl 模式开始,然后运行提供的 delete(...).limit(n) reproducer。使用 table.getPrimaryKey().getFields() 覆盖单键和复合键,并验证生成的 YQL 使用键子查询;缺少主键时应产生描述性错误。
由索引模型根据 Issue 内容生成。
描述
Problem
When using jOOQ's delete(...).limit(n) with the YDB dialect, the generated SQL is:
DELETE FROM `test` LIMIT $jp1
YQL does not support the LIMIT clause on DELETE statements, so this fails with:
Status{code = GENERIC_ERROR(code=400080), issues = [19:3 - 19:3: extraneous input 'limit' expecting {<EOF>, ';'} (S_ERROR)]}
Reproducer
dsl.delete(TEST).limit(10).execute();
// → DELETE FROM `test` LIMIT $jp1 (GENERIC_ERROR)
Expected behavior
The dialect should emulate DELETE LIMIT n by rewriting it as a subquery using the table's primary key:
DELETE FROM `test` WHERE `key` IN (SELECT `key` FROM `test` LIMIT $jp1)
For composite PKs:
DELETE FROM `episodes`
WHERE (`series_id`, `season_id`, `episode_id`) IN (
SELECT `series_id`, `season_id`, `episode_id`
FROM `episodes`
LIMIT $jp1
)
Implementation notes
jOOQ already has a similar emulation tracked in jOOQ/jOOQ#7839 for other databases that lack native DELETE LIMIT support.
For this dialect the natural place is a custom DeleteQuery implementation in org.jooq.impl (mirroring the existing UpsertReplaceQueryImpl pattern), wired in via YdbDSLContextImpl.deleteQuery(). The PK fields are available through table.getPrimaryKey().getFields() when the table is code-generated. When PK is unavailable the implementation should throw a descriptive error.
Environment
jooq-ydb-dialectversion: 1.2.1- jOOQ: 3.19.x
- YQL does not support
DELETE ... LIMIT(confirmed)
- 主要语言
- Java
- 星标
- 78
- 派生
- 24
- 平均合并
- 5 小时 45 分钟
- 30 天内合并 PR
- 3
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
ydb-platform/ydb-java-dialects 的其他 Issue
-
[BUG]: #hibernate-v6 UnsupportedOperationException: YDB does not support FOR UPDATE statement可能重新可做 @KirillKurdyukov 于 404 天前认领,目前没有进行中的 PR。 未关闭bug
ydb-platform/ydb-java-dialects#194 · 1 条评论 · 1 个 reaction · 已指派 1 人 ·
-
feat: Support adding @YdbType annotation to method parameters可能已有人在做 @KirillKurdyukov 于 614 天前认领。 未关闭pending-design
ydb-platform/ydb-java-dialects#173 · 10 条评论 · 1 个 reaction · 已指派 1 人 ·
-
student-projects
难度 5/5 一周以上 新手友好度 15/100
ydb-platform/ydb-java-dialects#170 · 2 条评论 ·
-
feat: Jimmer ORM可能已有人在做 @Rinoyt 于 169 天前认领。 未关闭student-projects
难度 5/5 一周以上 新手友好度 20/100
-
feat: SLO Hibernate可能重新可做 @KirillKurdyukov 于 782 天前认领,目前没有进行中的 PR。 未关闭
ydb-platform/ydb-java-dialects#147 · 已指派 1 人 ·
查看 ydb-platform/ydb-java-dialects 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
QuiltMC/update-quilt-meta#28 ·
-
area/kotlin
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
Large page[number] overflows the computed offset and returns the wrong page可能已有人在做 @auraseb 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复