def _pgsql_numerical_version_to_string(version_num):
    """Convert numerical PostgreSQL version to string."""
    if version_num < 100000:
        major = version_num // 10000
        minor = version_num % 10000 // 100
        patch = version_num % 100
        return f"{major}.{minor}.{patch}"

    # version 10+
    major = version_num // 10000
    patch = version_num % 10000
    return f"{major}.{patch}"