0

I've got some semantic version details to store, and figured a dedicated type would be a bit help with searches and sorts. At least one implementation exists:

https://github.com/theory/pg-semver

This is not supported on RDS. why we're on RDS. Is there an alternative that's RDS enabled? I'm considering either ltree or simply using a text or citext and grinding out the necessary queries and sorts, as needed.

Thanks

1 Answer 1

2

You could use an array of integers e.g. version 1.2.3 would be array[1,2,3].

Such an array compares (and sorts) correctly. To format it as a string, you could write some simple functions.

Parsing is simple as well: string_to_array('1.2.3', '.')::int[]

1
  • Interesting suggestion, I hadn't thought of that. I'll experiment with what the queries look like. I'd love a real semantic versioning type....but it's AWS letting me down here, not Postgres. Nov 23, 2019 at 21:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.