【发布时间】:2020-10-15 02:50:05
【问题描述】:
我的数据库中有一个表,它将字符串值列表存储为 jsonb 字段。
create table rabbits_json (
rabbit_id bigserial primary key,
name text,
info jsonb not null
);
insert into rabbits_json (name, info) values
('Henry','["lettuce","carrots"]'),
('Herald','["carrots","zucchini"]'),
('Helen','["lettuce","cheese"]');
我想过滤我的行,检查 info 是否包含给定值。 在 SQL 中,我会使用 ? operator:
select * from rabbits_json where info ? 'carrots';
如果我今天的谷歌搜索技能很好,我相信这还没有在 JOOQ 中实现: https://github.com/jOOQ/jOOQ/issues/9997
如何在查询中使用原生谓词在 JOOQ 中编写等效查询?
【问题讨论】:
标签: jooq