From: William Grzybowski <william@grzy.org>
Date: Thu, 18 Nov 2021 22:49:26 -0400
Subject: Fix for debian suffix on pg_config --version

Bug-Debian: http://bugs.debian.org/890646
Last-Update: 2019-07-12
---
 postgresql/installation.py  | 2 +-
 postgresql/versionstring.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/postgresql/installation.py b/postgresql/installation.py
index d8ed57a..e3cfcb6 100644
--- a/postgresql/installation.py
+++ b/postgresql/installation.py
@@ -212,7 +212,7 @@ class Installation(pg_api.Installation):
 		"""
 		self.info = info
 		self.version = self.info["version"]
-		self.type, vs = self.version.split()
+		self.type, vs = self.version.split()[:2]
 		self.version_info = versionstring.normalize(versionstring.split(vs))
 		self.configure_options = dict(
 			parse_configure_options(self.info.get('configure', ''))
diff --git a/postgresql/versionstring.py b/postgresql/versionstring.py
index ccb3953..2503013 100644
--- a/postgresql/versionstring.py
+++ b/postgresql/versionstring.py
@@ -15,7 +15,7 @@ def split(vstr : str) -> (
 	Split a PostgreSQL version string into a tuple
 	(major,minor,patch,...,state_class,state_level)
 	"""
-	v = vstr.strip().split('.')
+	v = vstr.strip().split(' ')[0].split('.')
 
 	# Get rid of the numbers around the state_class (beta,a,dev,alpha, etc)
 	state_class = v[-1].strip('0123456789')
