我正在尝试通过 Postgres 中 jsonb 字段上的属性将普通表连接到具有 jsonb 字段的表。例子:
普通表:
create table Res
(
id uuid default uuid_generate_v4() not null
constraint res_pkey
primary key
)
;
Run Code Online (Sandbox Code Playgroud)
带有 jsonb 的表:
create table res_rem_sent
(
body jsonb not null,
search tsvector,
created_at timestamp with time zone default now(),
id uuid default uuid_generate_v4() not null
constraint res_rem_sent_pkey
primary key
);
create index idx_res_rem_sent
on res_rem_sent (body)
;
create index idx_search_res_rem_sent
on res_rem_sent (search)
;
Run Code Online (Sandbox Code Playgroud)
该body
字段可能如下所示:{"resId": <GUID>, ....}
我想将res
表连接到id等于给定 GUID id …