2 ms·
Ranges are interesting. I had an app once that dealt with biodiesel. Each gallon of biodiesel needs a serial number. I cannot remember all the rules, but you
by protomyth 8y ago
Ranges are interesting. I had an app once that dealt with biodiesel. Each gallon of biodiesel needs a serial number. I cannot remember all the rules, but you assign the numbers sequentially at the origin. So, a 10,000 gallon truck would have XXXXX00001 - XXXXX10000. When you offloaded into a bigger container it would have those numbers plus any ranges already in the tank. Loading would entail picking an amount from the ranges, reducing the range in the tank, and assigning it to the truck. We had routines for all this including consolidating ranges (two trucks dumping into a tank with sequential ranges would create a big range) or subtracting from ranges. A truck could end up with a collection of ranges. It was all arbitrary in a way and weird. I really hope they do it differently now.
I wonder how hard it would be to write that in PostgreSQL these days using the range types?