Tenho a seguinte tabela:
CREATE TABLE post (
id bigint primary key,
thread_id bigint,
is_notice boolean,
title text,
content text
)
Eu exponho a lista usando a seguinte consulta:
SELECT * FROM post ORDER BY is_notice desc, thread_id desc, id
Então, dado o post selecionado por id(ie SELECT * FROM post where id=3
), como eu recupero os posts seguintes e anteriores?