I have a table like this
Post
id: text pk not null
content: text not null
author_id: text fk references User(id) not null
parent_id: text fk references Post(id)
My question is, how can I get every post from a child post (by using its id) up to the root post (where parent_id is null) in Postgres?
I was able to do it with this query