Fix Postgis version check (#23) (h/t [Krizz](https://github.com/Krizz))

Fixes Postgis version check to allow Beta/RC versions
This commit is contained in:
Kristjan 2019-10-06 17:13:39 +02:00 committed by Stepan Kuzmin
parent ac076834bf
commit 856c93c338

View File

@ -25,7 +25,7 @@ pub fn select_postgis_verion(pool: &PostgresPool) -> io::Result<String> {
.map_err(|err| io::Error::new(io::ErrorKind::Other, err.description()))?;
let version: String = conn
.query("select postgis_lib_version()", &[])
.query(r#"select (regexp_matches(postgis_lib_version(), '^(\d+\.\d+\.\d+)', 'g'))[1] as postgis_lib_version"#, &[])
.map(|rows| rows.get(0).get("postgis_lib_version"))?;
Ok(version)