electric-sql / electric

Sync little subsets of your Postgres data into local apps and services.
https://electric-sql.com
Apache License 2.0
6.2k stars 146 forks source link

fix (sync-service): query PG version number using PG's `server_version_num` setting #1721

Closed kevin-dp closed 2 weeks ago

kevin-dp commented 2 weeks ago

This PR fixes https://github.com/electric-sql/electric/issues/1712. We were previously reading out server_version which is a string and were casting it to an integer in order to get PG's major version number. However, casting to integer does not work when the server_version is set to e.g. 16.4 (Debian 16.4-1.pgdg1123+1) which some providers do. This PR changes this such that we no longer cast the string but instead read the version number from the server_version_num setting which is an integer (cf. https://pgpedia.info/s/server_version_num.html and https://pgpedia.info/s/server_version_num.html).