opengisch / pum

Postgres Upgrades Manager
GNU General Public License v2.0
30 stars 7 forks source link

Database version comparison is not robust #75

Closed elemoine closed 4 years ago

elemoine commented 4 years ago

Currently, if the current database version is 1.0.9, then pum upgrade won't apply a delta with version number 1.0.10. Because the version strings are compared, and the string "1.0.9" is greater than "1.0.10":

>>> "1.0.9" > "1.0.10"
True

In the same way a delta with version 1.0.9 will be applied after a delta with version 1.0.10. This is because Pum sorts deltas based on their version strings.

To fix that problem Pum needs to rely on setuptools' packaging.version.parse (see link for example). Or maybe rely on a semver library (example).