News for hackers. Stuff that matters.
Re:Prisma – ORM for Node.js and TypeScript by TheCoelacanth on Wednesday April 21, 2021 @04:18PM (#26894889)
I don't think SQL does compose well. Queries aren't first-class values in SQL.

I can write a query that queries the result of another query, but I can't store a query and then pass that somewhere to query from.

Re:Prisma – ORM for Node.js and TypeScript by pmontra on Wednesday April 21, 2021 @05:47PM (#26895867)
Maybe the WITH statement and CTEs can help you, if I understood correctly your complaint.

Check the example at the beginning of https://www.postgresql.org/docs/13/queries-with.html