PG Phriday: Getting It Sorted
When it comes to reordering the items in a list, databases have long had a kind of Faustian Bargain to accomplish the task. Nobody really liked any of the more common solutions, least of all the poor database tasked with serving up the inevitable resulting hack.
Postgres is no different in this regard. Consider a list_item
table like this, demonstrating five items in a to-do list: