in postgresql_metrics/postgres_queries.py [0:0]
def get_major_version(conn):
"""Get the major version part of the PostgreSQL version, i.e. the first two digits"""
results = query(conn, "SELECT substring(version() from $$(\d+\.\d+)\.\d+$$)")
if results:
return results[0][0]
return None