Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[jooq] Add DELETE LIMIT emulation via subquery

未关闭
#217 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

@Naifff 已经在做这个了。

开始于 2026年10月9日。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
55/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
冷清
技术栈
java
领域
backend, databases

调研方向

从 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-dialect version: 1.2.1
  • jOOQ: 3.19.x
  • YQL does not support DELETE ... LIMIT (confirmed)
主要语言
Java
星标
78
派生
24
平均合并
5 小时 45 分钟
30 天内合并 PR
3

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

ydb-platform/ydb-java-dialects 的其他 Issue

查看 ydb-platform/ydb-java-dialects 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。