Here's what I've got so far. I think there's probably more gold to be mined in terms of reducing runtime memory consumption (I don't like the list_free_deep bit, we should use a context), but functionally it seems complete. I'm off to dinner again, it's in your court to look over some more if you want.
(PS: if you want to apply, go ahead, don't forget catversion bump.) regards, tom lane
binYX6JKaCeEm.bin
Description: values-lists-1.patch.gz
---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend