在来这里打扰你之前,我试图尽可能多地记录我自己的话题,但无论如何我都在这里。
我们想在这个表上实现键集分页:
create table api.subscription (
subscription_id uuid primary key,
token_id uuid not null,
product_id uuid not null references api.product(product_id) deferrable,
spid bigint null,
attributes_snapshot jsonb not null,
created_at timestamp not null,
refreshed_at timestamp,
enriched_at timestamp null,
valid_until timestamp not null,
is_cancelled boolean not null,
has_been_expired boolean not null,
has_quality_data boolean not null
);
Run Code Online (Sandbox Code Playgroud)
为此,我们使用此查询来准备分页元数据:
with book as (
select created_at, subscription_id
from api.subscription
where token_id = $1
and refreshed_at >= $2
and valid_until >= now()
and not is_cancelled
and …
Run Code Online (Sandbox Code Playgroud)