Kääriäinen Anssi <anssi.kaariainen@thl.fi> writes:
> This has the side effect that you can also have downgrade scripts. I
> don't know if this is designed or just coincidental, so thought it
> would be worth mentioning.
Yeah, that's intentional and IMO worth supporting.
We do have to be sure that the chain-finding algorithm doesn't choke on
loops in the graph, but AFAICS Dijkstra's algorithm doesn't have a
problem with that. As long as we consider that each step has positive
cost, it won't execute a loop.
> The worst case is that if you are upgrading from 1.2 to 2.0 the path
> is 1.2 -> 1.1 -> 2.0, even if there exists a path 1.2 -> 1.8 -> 1.9 ->
> 2.0. This could potentially result in data loss, if the downgrade
> drops some columns or something like that.
Hmm. That seems like it would require a rather pathological collection
of upgrade scripts. In particular why would you have a one-step upgrade
from 1.1 to 2.0 but no short path from 1.2?
regards, tom lane