gpt4 book ai didi

postgresql - jOOQ 是否支持 PostgreSQL 的 C 风格转义字符串?

转载 作者:行者123 更新时间:2023-11-29 13:47:02 24 4
gpt4 key购买 nike

jOOQ 是否支持 PostgreSQL 的 C 风格转义字符串?

我查询我在哪里分页(限制和偏移样式)并通过解析 EXPLAIN 的输出返回总计数,这是 PostgreSQL wiki 推荐的快速估计计数的方法之一( https://wiki.postgresql.org/wiki/Count_estimate ).当我最初实现这个函数时,我使用 PG 的 C 风格转义(https://www.postgresql.org/docs/9.5/static/sql-syntax-lexical.html 的第 4.1.2.2 节)对函数进行了转义。以下是根据 PG 的有效查询,但是当尝试在 jOOQ 中呈现它时 Tools#renderAndBind(Context<?>, String, List<QueryPart>)抛出 ArrayIndexOutOfBoundsException因为它选择搜索词中的双引号作为标识符的开头,并跑到数组的末尾寻找另一个。

select 
(
select count_estimate(E'select 1
from "public"."foo"
where (
"public"."foo"."name" = \'"\'
)')
) as "total",
(
select array_to_json(coalesce(
array_agg("alias_95585617"."data" order by
"alias_95585617"."name" asc nulls last
),
cast('{}' as jsonb[])
))
from (
select
"public"."foo"."name",
row(
"public"."foo"."id",
"public"."foo"."name"
) as "data"
from "public"."foo"
where (
"public"."foo"."name" = '"'
)
order by
"public"."foo"."name" asc nulls last
limit 30
offset 120
) as "alias_95585617"
) as "data"

使用双美元引用在 jOOQ 中重新实现此功能按预期工作。我打算将其作为错误提交,但我想我会检查这是否是 jOOQ 打算首先支持的 PG 功能。

使用(Oracle JDK 1.8.0_144、jOOQ 3.8.3、PG 9.5.5、PGJDBC 42.1.4)

最佳答案

不,这在 jOOQ 3.10 中还不支持。但这当然是有道理的。我在路线图中添加了一个问题:https://github.com/jOOQ/jOOQ/issues/6704

关于postgresql - jOOQ 是否支持 PostgreSQL 的 C 风格转义字符串?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46731343/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com