※当サイトの記事には、広告・プロモーションが含まれます。

ChatGPTにTimescaleDBとPostgreSQLのバージョン対応表を出力するPythonコードをお願いしてみた

www.itmedia.co.jp

 米Cloudflareは12月5日(現地時間)、同日に発生した自社ネットワーク障害の原因と影響範囲を説明するブログを公開した。障害は同日8時47分から9時12分まで(協定世界時。日本時間では17時47分から18時12分まで)発生し、約25分間にわたって同社ネットワークの一部がダウンした。影響を受けたのはCloudflareが処理する全HTTPトラフィックの約28%に相当するという。

Cloudflare、約25分間のネットワーク障害の原因を説明し謝罪 - ITmedia NEWS

 今回の障害は自社システムに対するサイバー攻撃や悪意ある活動によるものではなく、「React Server Components」の新たな脆弱性への対応作業の一環として、Webアプリケーションファイアウォール(WAF)のボディ解析ロジックを変更したことが直接のきっかけであったと説明している。

Cloudflare、約25分間のネットワーク障害の原因を説明し謝罪 - ITmedia NEWS

 この変更が、同社の古いプロキシで動作するルールモジュール内のバグを顕在化させ、一部の構成の顧客環境でHTTP 500エラーが返される状態になった。問題は構成変更をロールバックすることで9時12分に解消されたとしている。

Cloudflare、約25分間のネットワーク障害の原因を説明し謝罪 - ITmedia NEWS

⇧ 最早、「本番環境(PRD:PRODUCTION)」と同等の「検証環境」が用意できないのか、適切な「検証」ができない状態なんだろうな...

「本番環境(PRD:PRODUCTION)」と同じ構成の「検証環境」が用意できていて、適切な「検証」が事前に実施できていれば、「本番環境(PRD:PRODUCTION)」で障害が発生することは理論上は無いはずだものな...

とりあえず、「影響範囲」の特定ができてない「状態」だと思われるので、同じようなことが繰り返される気がしますな...

まぁ、「影響範囲」の特定ができない「状態」というのが近いのかもしれませんが...

おそらく、「変更容易性」が著しく低い「状態」になっているんだろうな...

ただ、記事の説明が正しいとするならば、「JavaScript」の「ライブラリ」の「React」の「機能」の「脆弱性」のせいという見方もできるので、「React」の「設計」がイケてないと捉えることもできそうではあるのよね...

作業者にかかる精神的負担が大き過ぎるのよな...

ChatGPTにTimescaleDBとPostgreSQLのバージョン対応表を出力するPythonコードをお願いしてみた

前に、

ts0818.hatenablog.com

⇧ 上記の記事の時に、

  1. TimescaleDB
  2. PostgreSQL

の各々の「バージョン」の対応表が、「TimescaleDB」のソースコードが公開されている公式のGitHubで公開されていなさそうだな、という話をした。

何かと、バグの多い「TimescaleDB」なのだが、「バージョン」特有のバグも多いらしく、安定しないことこの上ないので、「マイグレーション」対応が必要になってくるのだが、肝心の、

  1. TimescaleDB
  2. PostgreSQL

の各々の「バージョン」の対応表が見当たらないのよ...

と言うわけで、「ChatGPT」氏の「検索」モードを指定して、「TimescaleDB」の「GitHub」の情報から、

  1. TimescaleDB
  2. PostgreSQL

の各々の「バージョン」の対応表を作成する「Python」のスクリプトの生成をお願いしてみた。

 

 

■TimescaleDBとPostgreSQLのバージョン対応表を作成する

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import subprocess
import os
import re
import csv
import sys
from typing import Dict, List, Tuple, Set, Optional

REPO_URL: str = "https://github.com/timescale/timescaledb.git"
REPO_DIR: str = "./timescaledb"

# -------------------------------------------------------
#  バージョンソート用:タグを「自然順」で比較可能なキーに変換
# -------------------------------------------------------
def version_sort_key(tag: str) -> Tuple[int, ...]:
    """
    タグ名の中から最初に現れる「数字で始まるセマンティックバージョン」を抽出して
    それをソートキーとして利用する。

    例:
        loader-2.11.0p1 → 2.11.0p1
        tsdb-1.7.0      → 1.7.0
        2.23.1          → 2.23.1
    """

    # --- 1) 数字で始まる部分を抽出 ---
    m = re.search(r"(\d+(\.\d+)*([a-zA-Z0-9]+)?)", tag)
    if not m:
        # 数字がないタグは最後に回す
        return (9999,)

    ver = m.group(1)

    # --- 2) 数字部分と suffix を分離 ---
    # 例: "2.11.0p1" → main="2.11.0", suffix="p1"
    m2 = re.match(r"(\d+(?:\.\d+)*)(.*)", ver)
    main = m2.group(1)
    suffix = m2.group(2)

    nums = tuple(int(x) for x in main.split("."))

    # --- 3) suffix の分類 ---
    suffix_group = 4  # 4 = stable
    suffix_num = 0

    if suffix:
        s = suffix.lower()

        if s.startswith("alpha"):
            suffix_group = 0
        elif s.startswith("beta"):
            suffix_group = 1
        elif s.startswith("rc"):
            suffix_group = 2
        elif s.startswith("dev"):
            suffix_group = 3
        elif s.startswith("p"):     # ← 追加: post release (p1, p2 ...)
            suffix_group = 5
        else:
            suffix_group = 6  # その他の suffix

        mnum = re.search(r"\d+", s)
        suffix_num = int(mnum.group()) if mnum else 0

    return nums + (suffix_group, suffix_num)


# -------------------------------------------------------
#  リポジトリ clone(必要時のみ)
# -------------------------------------------------------
def ensure_repo_cloned(
    repo_dir: str = REPO_DIR,
    repo_url: str = REPO_URL
) -> None:
    """
    timescaledb リポジトリを、存在しないときだけ clone する。
    """
    git_dir = os.path.join(repo_dir, ".git")
    if not os.path.isdir(repo_dir) or not os.path.isdir(git_dir):
        print(f"Cloning repository to {repo_dir} ...")
        subprocess.check_call(["git", "clone", repo_url, repo_dir])
    else:
        print(f"Repository exists at {repo_dir} — skipping clone.")


# -------------------------------------------------------
#  PostgreSQL バージョン抽出パターン
# -------------------------------------------------------
PG_PATTERNS: List[re.Pattern] = [
    re.compile(r"PostgreSQL\s+(\d{2})(?:\s*[,/&]\s*(\d{2}))*", re.IGNORECASE),
    re.compile(r"\bPG(?:ostgreSQL)?\s*(\d{2})(?:\s*[/&]\s*(\d{2}))*", re.IGNORECASE),
    re.compile(r"PostgreSQL\s+(\d{2})\s*[-–]\s*(\d{2})", re.IGNORECASE),
]

DOC_FILES: List[str] = [
    "CHANGELOG.md", "CHANGELOG",
    "HISTORY.md", "HISTORY",
    "RELEASE_NOTES.md", "RELEASE_NOTES",
]


# -------------------------------------------------------
#  Git 操作
# -------------------------------------------------------
def get_git_tags(repo_dir: str = REPO_DIR) -> List[str]:
    out: str = subprocess.check_output(
        ["git", "-C", repo_dir, "tag"], text=True
    )
    return [t.strip() for t in out.splitlines() if t.strip()]


def checkout_tag(repo_dir: str, tag: str) -> None:
    subprocess.check_call(
        ["git", "-C", repo_dir, "checkout", "--detach", tag],
        stdout=subprocess.DEVNULL,
        stderr=subprocess.DEVNULL,
    )


# -------------------------------------------------------
#  PostgreSQL 対応バージョン抽出
# -------------------------------------------------------
def parse_pg_versions(text: str) -> List[str]:
    versions: Set[str] = set()
    for patt in PG_PATTERNS:
        for m in patt.finditer(text):
            groups = m.groups()
            nums = [g for g in groups if g]

            # range パターン
            if len(nums) == 2 and patt.pattern.endswith(r"[-–]\s*(\d{2})"):
                start, end = map(int, nums)
                for v in range(start, end + 1):
                    versions.add(str(v))
            else:
                for v in nums:
                    versions.add(v)

    return sorted(versions, key=lambda x: int(x))


def find_pg_versions_in_repo(repo_dir: str) -> List[str]:
    found: Set[str] = set()

    for fname in DOC_FILES:
        path = os.path.join(repo_dir, fname)
        if os.path.isfile(path):
            try:
                text: str = open(path, encoding="utf-8", errors="ignore").read()
            except Exception:
                print(f"Could not read {path}", file=sys.stderr)
                continue

            vers = parse_pg_versions(text)
            found.update(vers)

    return sorted(found, key=lambda x: int(x))


# -------------------------------------------------------
#  互換表作成
# -------------------------------------------------------
def build_matrix(repo_dir: str = REPO_DIR) -> Tuple[Dict[str, List[str]], List[str]]:
    tags: List[str] = get_git_tags(repo_dir)
    matrix: Dict[str, List[str]] = {}
    unresolved: List[str] = []

    for tag in tags:
        try:
            checkout_tag(repo_dir, tag)
        except subprocess.CalledProcessError:
            print(f"Skipping tag {tag} (checkout failed)", file=sys.stderr)
            continue

        pgvers = find_pg_versions_in_repo(repo_dir)

        if not pgvers:
            unresolved.append(tag)

        matrix[tag] = pgvers

    return matrix, unresolved


# -------------------------------------------------------
#  CSV / Markdown 出力(TimescaleDB バージョンは降順にソート)
# -------------------------------------------------------
def save_matrix_csv(matrix: Dict[str, List[str]], out_path: str = "timescaledb_pg_compat.csv") -> None:
    all_pg: List[str] = sorted(
        {pg for pg_list in matrix.values() for pg in pg_list},
        key=lambda x: int(x)
    )

    with open(out_path, "w", newline="", encoding="utf-8") as f:
        writer = csv.writer(f)
        writer.writerow(["TimescaleDB"] + all_pg)

        # --- 降順 ---
        for ts in sorted(matrix.keys(), key=version_sort_key, reverse=True):
            row = [ts] + [("YES" if pg in matrix[ts] else "") for pg in all_pg]
            writer.writerow(row)

    print("Saved compatibility matrix to", out_path)


def save_matrix_markdown(matrix: Dict[str, List[str]], out_path: str = "timescaledb_pg_compat.md") -> None:
    all_pg: List[str] = sorted(
        {pg for pg_list in matrix.values() for pg in pg_list},
        key=lambda x: int(x)
    )

    with open(out_path, "w", encoding="utf-8") as f:
        header = ["TimescaleDB"] + all_pg
        f.write("| " + " | ".join(header) + " |\n")
        f.write("|" + "|".join("---" for _ in header) + "|\n")

        # --- 降順 ---
        for ts in sorted(matrix.keys(), key=version_sort_key, reverse=True):
            row = [ts] + [("✅" if pg in matrix[ts] else "") for pg in all_pg]
            f.write("| " + " | ".join(row) + " |\n")

    print("Saved compatibility matrix to", out_path)


# -------------------------------------------------------
#  Main
# -------------------------------------------------------
if __name__ == "__main__":
    ensure_repo_cloned()

    matrix, unresolved = build_matrix()

    save_matrix_csv(matrix)
    save_matrix_markdown(matrix)

    if unresolved:
        print("⚠️ WARNING: No PG versions found for these tags:", file=sys.stderr)
        for t in unresolved:
            print("  -", t, file=sys.stderr)
        print("You may need to manually check these.", file=sys.stderr)

⇧ 上記のような「Python」の「スクリプト」を用意する。

適当な「ディレクトリ」を作成後、「ディレクトリ」に移動し「Python」の「venv」の「機能」で「Python仮想環境」を作成する。

python -m venv .venv    

ちなみに、「-m」オプションはというと、

misprochef.com

⇧ 上記サイト様にありますように、「Python」の「モジュール」を利用するという意味らしい。

「Python」の「組み込み」の「モジュール」だけでなく、自分で用意した「Python」ファイルも「モジュール」として利用できるらしい。

 

話が脱線しましたが、「src」ディレクトリを作成して、用意しておいた「Python」の「スクリプト」の「main.py」を「src」ディレクトリに配置します。

ディレクトリ構成とかは、以下のような感じになる

D:\work-soft\python\timescaledb_version_matrix
│ 
├─ .venv
│    ├─Scripts
│    │    ├─activate
│    │    ├─activate.bat
│    │    ├─activate.fish
│    │    ├─Activate.ps1
│    │    ├─deactivate.bat
│    │    ├─pip.exe
│    │    ├─pip3.13.exe
│    │    ├─pip3.exe
│    │    ├─python.exe
│    │    └─pythonw.exe
│    ├─Include
│    ├─Lib
│    ├─.gitignore
│    └─pyvenv.cfg
└─  src 
      └─ main.py

で、

cd /d D:\work-soft\python\timescaledb_version_matrix

「Python仮想環境」にログインする。

.venv\actibate.bat

「src」ディレクトリに移動し、「main.py」を実行する

cd src
python main.py

「CSV」ファイルを出力してくれる。

■timescaledb_pg_compat.csv

No TimescaleDB 10 11 12 13 14 15 16 17 18
1 2.24.0 YES YES YES YES YES YES YES YES YES
2 2.23.1 YES YES YES YES YES YES YES YES YES
3 2.23.0 YES YES YES YES YES YES YES YES YES
4 2.22.1 YES YES YES YES YES YES YES YES YES
5 2.22.0 YES YES YES YES YES YES YES YES YES
6 2.21.4 YES YES YES YES YES YES YES YES  
7 2.21.3 YES YES YES YES YES YES YES YES  
8 2.21.2 YES YES YES YES YES YES YES YES  
9 2.21.1 YES YES YES YES YES YES YES YES  
10 2.21.0 YES YES YES YES YES YES YES YES  
11 2.20.3 YES YES YES YES YES YES YES YES  
12 2.20.2 YES YES YES YES YES YES YES YES  
13 2.20.1 YES YES YES YES YES YES YES YES  
14 2.20.0 YES YES YES YES YES YES YES YES  
15 2.19.3 YES YES YES YES YES YES YES YES  
16 2.19.2 YES YES YES YES YES YES YES YES  
17 2.19.1 YES YES YES YES YES YES YES YES  
18 2.19.0 YES YES YES YES YES YES YES YES  
19 2.18.2 YES YES YES YES YES YES YES YES  
20 2.18.1 YES YES YES YES YES YES YES YES  
21 2.18.0 YES YES YES YES YES YES YES YES  
22 2.17.2 YES YES YES YES YES YES YES YES  
23 2.17.1 YES YES YES YES YES YES YES YES  
24 2.17.0 YES YES YES YES YES YES YES YES  
25 2.16.1 YES YES YES YES YES YES YES    
26 2.16.0 YES YES YES YES YES YES YES    
27 2.15.3 YES YES YES YES YES YES YES    
28 2.15.2 YES YES YES YES YES YES YES    
29 2.15.1 YES YES YES YES YES YES YES    
30 2.15.0 YES YES YES YES YES YES YES    
31 2.14.2 YES YES YES YES YES YES YES    
32 2.14.1 YES YES YES YES YES YES YES    
33 2.14.0 YES YES YES YES YES YES YES    
34 2.13.1 YES YES YES YES YES YES YES    
35 2.13.0 YES YES YES YES YES YES YES    
36 2.13.0-dev YES YES YES YES YES YES YES    
37 2.13.0-dev1 YES YES YES YES YES YES YES    
38 2.12.2 YES YES YES YES YES YES YES    
39 2.12.2-rc1 YES YES YES YES YES YES YES    
40 2.12.1 YES YES YES YES YES YES YES    
41 2.12.1-rc1 YES YES YES YES YES YES YES    
42 2.12.0 YES YES YES YES YES YES YES    
43 2.12.0-rc1 YES YES YES YES YES YES YES    
44 2.12.0-rc2 YES YES YES YES YES YES YES    
45 2.11.2 YES YES YES YES YES YES      
46 2.11.2-rc1 YES YES YES YES YES YES      
47 2.11.2-rc2 YES YES YES YES YES YES      
48 2.11.1 YES YES YES YES YES YES      
49 2.11.1-rc1 YES YES YES YES YES YES      
50 loader-2.11.0p1 YES YES YES YES YES YES      
51 2.11.0 YES YES YES YES YES YES      
52 2.10.3 YES YES YES YES YES YES      
53 2.10.3-rc1 YES YES YES YES YES YES      
54 2.10.2 YES YES YES YES YES YES      
55 2.10.2-rc1 YES YES YES YES YES YES      
56 2.10.1 YES YES YES YES YES YES      
57 2.10.0 YES YES YES YES YES YES      
58 2.9.3 YES YES YES YES YES YES      
59 2.9.2 YES YES YES YES YES YES      
60 2.9.1 YES YES YES YES YES YES      
61 2.9.0 YES YES YES YES YES YES      
62 2.8.1 YES YES YES YES YES YES      
63 2.8.0 YES YES YES YES YES YES      
64 2.7.2 YES YES YES YES YES YES      
65 2.7.1 YES YES YES YES YES YES      
66 2.7.0 YES YES YES YES YES        
67 2.6.1 YES YES YES YES YES        
68 2.6.0 YES YES YES YES YES        
69 2.5.2 YES YES YES YES YES        
70 2.5.1 YES YES YES YES YES        
71 2.5.0 YES YES YES YES YES        
72 2.4.2 YES YES YES YES          
73 2.4.1 YES YES YES YES          
74 2.4.0 YES YES YES YES          
75 2.3.1 YES YES YES YES          
76 2.3.0 YES YES YES YES          
77 2.2.1 YES YES YES YES          
78 2.2.0 YES YES YES YES          
79 2.1.1 YES YES YES YES          
80 2.1.0 YES YES YES YES          
81 2.0.2 YES YES YES            
82 2.0.1 YES YES YES            
83 2.0.0 YES YES YES            
84 2.0.0-beta1 YES YES              
85 2.0.0-beta2 YES YES YES            
86 2.0.0-beta3 YES YES YES            
87 2.0.0-beta4 YES YES YES            
88 2.0.0-beta5 YES YES YES            
89 2.0.0-beta6 YES YES YES            
90 2.0.0-private-beta-1 YES YES              
91 2.0.0-rc1 YES YES YES            
92 2.0.0-rc2 YES YES YES            
93 2.0.0-rc3 YES YES YES            
94 2.0.0-rc3-w YES YES YES            
95 2.0.0-rc4 YES YES YES            
96 1.7.5 YES YES YES            
97 1.7.4 YES YES YES            
98 1.7.3 YES YES YES            
99 1.7.2 YES YES YES            
100 1.7.1 YES YES YES            
101 1.7.0 YES YES YES            
102 1.6.1 YES YES              
103 1.6.0 YES YES              
104 1.5.1 YES YES              
105 1.5.0 YES YES              
106 1.4.2 YES YES              
107 1.4.1 YES YES              
108 1.4.0 YES YES              
109 1.3.2 YES YES              
110 1.3.1 YES YES              
111 1.3.0 YES YES              
112 1.2.2 YES YES              
113 1.2.1 YES YES              
114 1.2.0 YES YES              
115 1.1.1 YES YES              
116 1.1.0 YES YES              
117 1.0.1 YES                
118 1.0.0 YES                
119 1.0.0-rc1 YES                
120 1.0.0-rc2 YES                
121 1.0.0-rc3 YES                
122 0.12.1 YES                
123 0.12.0 YES                
124 0.11.0 YES                
125 0.10.1 YES                
126 0.10.0 YES                
127 0.9.2 YES                
128 0.9.1 YES                
129 0.9.0 YES                
130 0.8.0 YES                
131 0.7.1 YES                
132 0.7.0 YES                
133 0.6.1                  
134 0.6.0                  
135 0.5.0                  
136 0.4.2                  
137 0.4.1                  
138 0.4.0                  
139 0.3.0                  
140 0.2.0                  
141 0.1.0                  
142 0.0.12-beta                  
143 0.0.11-beta                  
144 0.0.10-beta                  
145 0.0.9-beta                  
146 0.0.8-beta                  
147 0.0.7-beta                  
148 0.0.6-beta                  
149 0.0.5-beta                  
150 0.0.4-beta                  
151 0.0.3-beta                  
152 0.0.2-beta                  
153 0.0.1-beta                  

 

とりあえず、「PostgreSQL」の対応バージョンの抽出ができてないっぽい...

つまり、全くもって駄目駄目な結果である...

「TimescaleDB」の「ソースコード」が公開されている公式の「GitHub」の「Git」の「リポジトリ」から取得できそうな情報からだと、限界があるってことですかね...

一応、「Tag」の数は合ってそうではあるが...

各々の「Tag」の「リリースノート」の情報を目視で確認して「ファクトチェック」するのは辛過ぎるので、やはり、公式で、

  1. TimescaleDB
  2. PostgreSQL

の「バージョン」対応表を公開して欲しいお気持ち...

「OSS(Open Source Software)」とは言え、「動作確認」してくれていると思うので、「バージョン」の対応表も公開して然るべきな気もするんだが...

 

とりあえず、「ChatGPT」氏の回答が使い物にならな過ぎたので

github.com

⇧ 上記の「docs/BuildSource.md」の情報を元にした「ソースコード」もお願いしてみた。「ChatGPT」氏については、「幻覚(ハルシネーション)」の問題があるので「推論」の「機能」に欠陥があるのは致し方ないのだが、「検索」の「機能」ぐらいはまともに力を発揮して欲しかったですな...

「検索」で人間に劣ってどうするんだって話ですが...

まぁ、それほどの「大情報化社会」に我々は生きているということになるのだとは思いますが...

日々疲弊し続けていくことになる世の中になってますな...

話が脱線しましたが、以下、「Python」の「ソースコード」になります。

 

import subprocess
import os
import re
import csv

# PostgreSQLの対象バージョン
PG_VERSIONS = [str(i) for i in range(10, 19)]

# TimescaleDB リポジトリのパス
REPO_PATH = "../timescaledb"  # 適宜変更してください

def run_git(args, cwd):
    try:
        result = subprocess.run(
            ["git"] + args,
            cwd=cwd,
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            text=True,
            check=True
        )
        return result.stdout.strip()
    except subprocess.CalledProcessError as e:
        print(f"Warning: Git command failed: {' '.join(['git']+args)}")
        print(f"stderr: {e.stderr.strip()}")
        return ""

def get_tags(repo_path):
    tags = run_git(["tag"], cwd=repo_path).splitlines()
    # バージョン順に降順
    def version_key(tag):
        # 例: 2.24.0 -> [2,24,0]
        nums = re.findall(r'\d+', tag)
        return [int(n) for n in nums]
    tags.sort(key=version_key, reverse=True)
    return tags

def parse_buildsource(buildsource_path):
    """BuildSource.md から PostgreSQL バージョンを抽出"""
    pg_matrix = {v: "-" for v in PG_VERSIONS}
    try:
        with open(buildsource_path, "r", encoding="utf-8") as f:
            content = f.read()
            # 例: "A standard PostgreSQL 14, 13.2+ or 12"
            match = re.search(r"PostgreSQL ([\d\.,\+\sor]+)", content)
            if match:
                version_str = match.group(1)
                # カンマや "or" で分割
                parts = re.split(r"[, ]+or[ ]*|,\s*", version_str)
                versions = set()
                for p in parts:
                    p = p.strip()
                    if not p:
                        continue
                    # マイナーバージョンは無視してメジャーだけ
                    m = re.match(r"(\d+)", p)
                    if m:
                        versions.add(int(m.group(1)))
                if versions:
                    min_v = min(versions)
                    max_v = max(versions)
                    # 範囲内をYESにする
                    for v in PG_VERSIONS:
                        v_int = int(v)
                        if min_v <= v_int <= max_v:
                            pg_matrix[v] = "YES"
    except Exception as e:
        print(f"Error reading {buildsource_path}: {e}")
    return pg_matrix

def build_matrix(repo_path):
    tags = get_tags(repo_path)
    matrix = []
    for idx, tag in enumerate(tags, 1):  # 項番を追加(1からカウント)
        print(f"{idx}. Processing tag: {tag} -> ", end="")  # 1行で出力するために "->" の後に続けて出力
        # タグに切り替え
        run_git(["checkout", "-f", tag], cwd=repo_path)
        buildsource_path = os.path.join(repo_path, "docs", "BuildSource.md")
        if os.path.isfile(buildsource_path):
            print(f"BuildSource.md found")  # 1行で結果を出力
            pg_matrix = parse_buildsource(buildsource_path)
        else:
            print(f"BuildSource.md not found, using '-'")  # 1行で結果を出力
            pg_matrix = {v: "-" for v in PG_VERSIONS}
        matrix.append([tag] + [pg_matrix[v] for v in PG_VERSIONS])
    return matrix

def write_csv(matrix, output_file="timescaledb_postgres_matrix.csv"):
    with open(output_file, "w", newline="", encoding="utf-8") as f:
        writer = csv.writer(f, delimiter="\t")
        writer.writerow(["TimescaleDB"] + PG_VERSIONS)
        for row in matrix:
            writer.writerow(row)
    print(f"CSV written to {output_file}")

def main():
    if not os.path.isdir(REPO_PATH):
        print(f"Error: Repository path {REPO_PATH} does not exist")
        print("Cloning repository...")
        subprocess.run(["git", "clone", "https://github.com/timescale/timescaledb.git", REPO_PATH])
    matrix = build_matrix(REPO_PATH)
    write_csv(matrix)

if __name__ == "__main__":
    main()

■CSVファイル

2.24.0 YES2.24.0 YES YES YES2.24.0 - - - - - YES YES YES -
No TimescaleDB 10 11 12 13 14 15 16 17 18
1 2.24.0 - - - - - YES YES YES -
2 2.23.1 - - - - - YES YES YES -
3 2.23.0 - - - - - YES YES YES -
4 2.22.1 - - - - - YES YES YES -
5 2.22.0 - - - - - YES YES YES -
6 2.21.4 - - - - - YES YES YES -
7 2.21.3 - - - - - YES YES YES -
8 2.21.2 - - - - - YES YES YES -
9 2.21.1 - - - - - YES YES YES -
10 2.21.0 - - - - - YES YES YES -
11 2.20.3 - - - - - YES YES YES -
12 2.20.2 - - - - - YES YES YES -
13 2.20.1 - - - - - YES YES YES -
14 2.20.0 - - - - - YES YES YES -
15 2.19.3 - - - - YES YES YES YES -
16 2.19.2 - - - - YES YES YES YES -
17 2.19.1 - - - - YES YES YES YES -
18 2.19.0 - - - - YES YES YES YES -
19 2.18.2 - - - - YES YES YES - -
20 2.18.1 - - - - YES YES YES - -
21 2.18.0 - - - - YES YES YES - -
22 2.17.2 - - - - YES YES YES - -
23 2.17.1 - - - - YES YES YES - -
24 2.17.0 - - - - YES YES YES - -
25 2.16.1 - - - - YES YES YES - -
26 2.16.0 - - - - YES YES YES - -
27 2.15.3 - - - YES YES YES - - -
28 2.15.2 - - - YES YES YES - - -
29 2.15.1 - - - YES YES YES - - -
30 2.15.0 - - - YES YES YES - - -
31 2.14.2 - - - YES YES YES - - -
32 2.14.1 - - - YES YES YES - - -
33 2.14.0 - - - YES YES YES - - -
34 2.13.1 - - - YES YES YES - - -
35 2.13.0-dev1 - - - YES YES YES - - -
36 2.13.0 - - - YES YES YES - - -
37 2.13.0-dev - - - YES YES YES - - -
38 2.12.2-rc1 - - - YES YES YES - - -
39 2.12.2 - - - YES YES YES - - -
40 2.12.1-rc1 - - - YES YES YES - - -
41 2.12.1 - - - YES YES YES - - -
42 2.12.0-rc2 - - - YES YES YES - - -
43 2.12.0-rc1 - - - YES YES YES - - -
44 2.12.0 - - - YES YES YES - - -
45 2.11.2-rc2 - - YES YES YES - - - -
46 2.11.2-rc1 - - YES YES YES - - - -
47 2.11.2 - - YES YES YES - - - -
48 2.11.1-rc1 - - YES YES YES - - - -
49 2.11.1 - - YES YES YES - - - -
50 loader-2.11.0p1 - - YES YES YES - - - -
51 2.11.0 - - YES YES YES - - - -
52 2.10.3-rc1 - - YES YES YES - - - -
53 2.10.3 - - YES YES YES - - - -
54 2.10.2-rc1 - - YES YES YES - - - -
55 2.10.2 - - YES YES YES - - - -
56 2.10.1 - - YES YES YES - - - -
57 2.10.0 - - YES YES YES - - - -
58 2.9.3 - - YES YES YES - - - -
59 2.9.2 - - YES YES YES - - - -
60 2.9.1 - - YES YES YES - - - -
61 2.9.0 - - YES YES YES - - - -
62 2.8.1 - - YES YES YES - - - -
63 2.8.0 - - YES YES YES - - - -
64 2.7.2 - - YES YES YES - - - -
65 2.7.1 - - YES YES YES - - - -
66 2.7.0 - - YES YES YES - - - -
67 2.6.1 - - YES YES YES - - - -
68 2.6.0 - - YES YES YES - - - -
69 2.5.2 - - YES YES YES - - - -
70 2.5.1 - - YES YES YES - - - -
71 2.5.0 - - YES YES - - - - -
72 2.4.2 - - YES YES - - - - -
73 2.4.1 - - YES YES - - - - -
74 2.4.0 - - YES YES - - - - -
75 2.3.1 - YES YES YES - - - - -
76 2.3.0 - YES YES YES - - - - -
77 2.2.1 - YES YES - - - - - -
78 2.2.0 - YES YES - - - - - -
79 2.1.1 - YES YES - - - - - -
80 2.1.0 - YES YES - - - - - -
81 2.0.2 - YES YES - - - - - -
82 2.0.1 - YES YES - - - - - -
83 2.0.0-beta6 - YES YES - - - - - -
84 2.0.0-beta5 - YES YES - - - - - -
85 2.0.0-beta4 - YES YES - - - - - -
86 2.0.0-rc4 - YES YES - - - - - -
87 2.0.0-beta3 - YES YES - - - - - -
88 2.0.0-rc3 - YES YES - - - - - -
89 2.0.0-rc3-w - YES YES - - - - - -
90 2.0.0-beta2 - YES YES - - - - - -
91 2.0.0-rc2 - YES YES - - - - - -
92 2.0.0-beta1 - - - - - - - - -
93 2.0.0-private-beta-1 - - - - - - - - -
94 2.0.0-rc1 - YES YES - - - - - -
95 2.0.0 - YES YES - - - - - -
96 1.7.5 - YES YES - - - - - -
97 1.7.4 - YES YES - - - - - -
98 1.7.3 - YES YES - - - - - -
99 1.7.2 - YES YES - - - - - -
100 1.7.1 - YES YES - - - - - -
101 1.7.0 YES YES - - - - - - -
102 1.6.1 YES YES - - - - - - -
103 1.6.0 - - - - - - - - -
104 1.5.1 - - - - - - - - -
105 1.5.0 - - - - - - - - -
106 1.4.2 - - - - - - - - -
107 1.4.1 - - - - - - - - -
108 1.4.0 - - - - - - - - -
109 1.3.2 - - - - - - - - -
110 1.3.1 - - - - - - - - -
111 1.3.0 - - - - - - - - -
112 1.2.2 - - - - - - - - -
113 1.2.1 - - - - - - - - -
114 1.2.0 - - - - - - - - -
115 1.1.1 - - - - - - - - -
116 1.1.0 - - - - - - - - -
117 1.0.1 - - - - - - - - -
118 1.0.0-rc3 - - - - - - - - -
119 1.0.0-rc2 - - - - - - - - -
120 1.0.0-rc1 - - - - - - - - -
121 1.0.0 - - - - - - - - -
122 0.12.1 - - - - - - - - -
123 0.12.0 - - - - - - - - -
124 0.11.0 - - - - - - - - -
125 0.10.1 - - - - - - - - -
126 0.10.0 - - - - - - - - -
127 0.9.2 - - - - - - - - -
128 0.9.1 - - - - - - - - -
129 0.9.0 - - - - - - - - -
130 0.8.0 - - - - - - - - -
131 0.7.1 - - - - - - - - -
132 0.7.0 - - - - - - - - -
133 0.6.1 - - - - - - - - -
134 0.6.0 - - - - - - - - -
135 0.5.0 - - - - - - - - -
136 0.4.2 - - - - - - - - -
137 0.4.1 - - - - - - - - -
138 0.4.0 - - - - - - - - -
139 0.3.0 - - - - - - - - -
140 0.2.0 - - - - - - - - -
141 0.1.0 - - - - - - - - -
142 0.0.12-beta - - - - - - - - -
143 0.0.11-beta - - - - - - - - -
144 0.0.10-beta - - - - - - - - -
145 0.0.9-beta - - - - - - - - -
146 0.0.8-beta - - - - - - - - -
147 0.0.7-beta - - - - - - - - -
148 0.0.6-beta - - - - - - - - -
149 0.0.5-beta - - - - - - - - -
150 0.0.4-beta - - - - - - - - -
151 0.0.3-beta - - - - - - - - -
152 0.0.2-beta - - - - - - - - -
153 0.0.1-beta - - - - - - - - -

■コンソール出力

(.venv) D:\work-soft\python\timescaledb_version_matrix\src>python main.py
1. Processing tag: 2.24.0 -> BuildSource.md found
2. Processing tag: 2.23.1 -> BuildSource.md found
3. Processing tag: 2.23.0 -> BuildSource.md found
4. Processing tag: 2.22.1 -> BuildSource.md found
5. Processing tag: 2.22.0 -> BuildSource.md found
6. Processing tag: 2.21.4 -> BuildSource.md found
7. Processing tag: 2.21.3 -> BuildSource.md found
8. Processing tag: 2.21.2 -> BuildSource.md found
9. Processing tag: 2.21.1 -> BuildSource.md found
10. Processing tag: 2.21.0 -> BuildSource.md found
11. Processing tag: 2.20.3 -> BuildSource.md found
12. Processing tag: 2.20.2 -> BuildSource.md found
13. Processing tag: 2.20.1 -> BuildSource.md found
14. Processing tag: 2.20.0 -> BuildSource.md found
15. Processing tag: 2.19.3 -> BuildSource.md found
16. Processing tag: 2.19.2 -> BuildSource.md found
17. Processing tag: 2.19.1 -> BuildSource.md found
18. Processing tag: 2.19.0 -> BuildSource.md found
19. Processing tag: 2.18.2 -> BuildSource.md found
20. Processing tag: 2.18.1 -> BuildSource.md found
21. Processing tag: 2.18.0 -> BuildSource.md found
22. Processing tag: 2.17.2 -> BuildSource.md found
23. Processing tag: 2.17.1 -> BuildSource.md found
24. Processing tag: 2.17.0 -> BuildSource.md found
25. Processing tag: 2.16.1 -> BuildSource.md found
26. Processing tag: 2.16.0 -> BuildSource.md found
27. Processing tag: 2.15.3 -> BuildSource.md found
28. Processing tag: 2.15.2 -> BuildSource.md found
29. Processing tag: 2.15.1 -> BuildSource.md found
30. Processing tag: 2.15.0 -> BuildSource.md found
31. Processing tag: 2.14.2 -> BuildSource.md found
32. Processing tag: 2.14.1 -> BuildSource.md found
33. Processing tag: 2.14.0 -> BuildSource.md found
34. Processing tag: 2.13.1 -> BuildSource.md found
35. Processing tag: 2.13.0-dev1 -> BuildSource.md found
36. Processing tag: 2.13.0 -> BuildSource.md found
37. Processing tag: 2.13.0-dev -> BuildSource.md found
38. Processing tag: 2.12.2-rc1 -> BuildSource.md found
39. Processing tag: 2.12.2 -> BuildSource.md found
40. Processing tag: 2.12.1-rc1 -> BuildSource.md found
41. Processing tag: 2.12.1 -> BuildSource.md found
42. Processing tag: 2.12.0-rc2 -> BuildSource.md found
43. Processing tag: 2.12.0-rc1 -> BuildSource.md found
44. Processing tag: 2.12.0 -> BuildSource.md found
45. Processing tag: 2.11.2-rc2 -> BuildSource.md found
46. Processing tag: 2.11.2-rc1 -> BuildSource.md found
47. Processing tag: 2.11.2 -> BuildSource.md found
48. Processing tag: 2.11.1-rc1 -> BuildSource.md found
49. Processing tag: 2.11.1 -> BuildSource.md found
50. Processing tag: loader-2.11.0p1 -> BuildSource.md found
51. Processing tag: 2.11.0 -> BuildSource.md found
52. Processing tag: 2.10.3-rc1 -> BuildSource.md found
53. Processing tag: 2.10.3 -> BuildSource.md found
54. Processing tag: 2.10.2-rc1 -> BuildSource.md found
55. Processing tag: 2.10.2 -> BuildSource.md found
56. Processing tag: 2.10.1 -> BuildSource.md found
57. Processing tag: 2.10.0 -> BuildSource.md found
58. Processing tag: 2.9.3 -> BuildSource.md found
59. Processing tag: 2.9.2 -> BuildSource.md found
60. Processing tag: 2.9.1 -> BuildSource.md found
61. Processing tag: 2.9.0 -> BuildSource.md found
62. Processing tag: 2.8.1 -> BuildSource.md found
63. Processing tag: 2.8.0 -> BuildSource.md found
64. Processing tag: 2.7.2 -> BuildSource.md found
65. Processing tag: 2.7.1 -> BuildSource.md found
66. Processing tag: 2.7.0 -> BuildSource.md found
67. Processing tag: 2.6.1 -> BuildSource.md found
68. Processing tag: 2.6.0 -> BuildSource.md found
69. Processing tag: 2.5.2 -> BuildSource.md found
70. Processing tag: 2.5.1 -> BuildSource.md found
71. Processing tag: 2.5.0 -> BuildSource.md found
72. Processing tag: 2.4.2 -> BuildSource.md found
73. Processing tag: 2.4.1 -> BuildSource.md found
74. Processing tag: 2.4.0 -> BuildSource.md found
75. Processing tag: 2.3.1 -> BuildSource.md found
76. Processing tag: 2.3.0 -> BuildSource.md found
77. Processing tag: 2.2.1 -> BuildSource.md found
78. Processing tag: 2.2.0 -> BuildSource.md found
79. Processing tag: 2.1.1 -> BuildSource.md found
80. Processing tag: 2.1.0 -> BuildSource.md found
81. Processing tag: 2.0.2 -> BuildSource.md found
82. Processing tag: 2.0.1 -> BuildSource.md found
83. Processing tag: 2.0.0-beta6 -> BuildSource.md found
84. Processing tag: 2.0.0-beta5 -> BuildSource.md found
85. Processing tag: 2.0.0-beta4 -> BuildSource.md found
86. Processing tag: 2.0.0-rc4 -> BuildSource.md found
87. Processing tag: 2.0.0-beta3 -> BuildSource.md found
88. Processing tag: 2.0.0-rc3 -> BuildSource.md found
89. Processing tag: 2.0.0-rc3-w -> BuildSource.md found
90. Processing tag: 2.0.0-beta2 -> BuildSource.md found
91. Processing tag: 2.0.0-rc2 -> BuildSource.md found
92. Processing tag: 2.0.0-beta1 -> BuildSource.md not found, using '-'
93. Processing tag: 2.0.0-private-beta-1 -> BuildSource.md not found, using '-'
94. Processing tag: 2.0.0-rc1 -> BuildSource.md found
95. Processing tag: 2.0.0 -> BuildSource.md found
96. Processing tag: 1.7.5 -> BuildSource.md found
97. Processing tag: 1.7.4 -> BuildSource.md found
98. Processing tag: 1.7.3 -> BuildSource.md found
99. Processing tag: 1.7.2 -> BuildSource.md found
100. Processing tag: 1.7.1 -> BuildSource.md found
101. Processing tag: 1.7.0 -> BuildSource.md found
102. Processing tag: 1.6.1 -> BuildSource.md found
103. Processing tag: 1.6.0 -> BuildSource.md not found, using '-'
104. Processing tag: 1.5.1 -> BuildSource.md not found, using '-'
105. Processing tag: 1.5.0 -> BuildSource.md not found, using '-'
106. Processing tag: 1.4.2 -> BuildSource.md not found, using '-'
107. Processing tag: 1.4.1 -> BuildSource.md not found, using '-'
108. Processing tag: 1.4.0 -> BuildSource.md not found, using '-'
109. Processing tag: 1.3.2 -> BuildSource.md not found, using '-'
110. Processing tag: 1.3.1 -> BuildSource.md not found, using '-'
111. Processing tag: 1.3.0 -> BuildSource.md not found, using '-'
112. Processing tag: 1.2.2 -> BuildSource.md not found, using '-'
113. Processing tag: 1.2.1 -> BuildSource.md not found, using '-'
114. Processing tag: 1.2.0 -> BuildSource.md not found, using '-'
115. Processing tag: 1.1.1 -> BuildSource.md not found, using '-'
116. Processing tag: 1.1.0 -> BuildSource.md not found, using '-'
117. Processing tag: 1.0.1 -> BuildSource.md not found, using '-'
118. Processing tag: 1.0.0-rc3 -> BuildSource.md not found, using '-'
119. Processing tag: 1.0.0-rc2 -> BuildSource.md not found, using '-'
120. Processing tag: 1.0.0-rc1 -> BuildSource.md not found, using '-'
121. Processing tag: 1.0.0 -> BuildSource.md not found, using '-'
122. Processing tag: 0.12.1 -> BuildSource.md not found, using '-'
123. Processing tag: 0.12.0 -> BuildSource.md not found, using '-'
124. Processing tag: 0.11.0 -> BuildSource.md not found, using '-'
125. Processing tag: 0.10.1 -> BuildSource.md not found, using '-'
126. Processing tag: 0.10.0 -> BuildSource.md not found, using '-'
127. Processing tag: 0.9.2 -> BuildSource.md not found, using '-'
128. Processing tag: 0.9.1 -> BuildSource.md not found, using '-'
129. Processing tag: 0.9.0 -> BuildSource.md not found, using '-'
130. Processing tag: 0.8.0 -> BuildSource.md not found, using '-'
131. Processing tag: 0.7.1 -> BuildSource.md not found, using '-'
132. Processing tag: 0.7.0 -> BuildSource.md not found, using '-'
133. Processing tag: 0.6.1 -> BuildSource.md not found, using '-'
134. Processing tag: 0.6.0 -> BuildSource.md not found, using '-'
135. Processing tag: 0.5.0 -> BuildSource.md not found, using '-'
136. Processing tag: 0.4.2 -> BuildSource.md not found, using '-'
137. Processing tag: 0.4.1 -> BuildSource.md not found, using '-'
138. Processing tag: 0.4.0 -> BuildSource.md not found, using '-'
139. Processing tag: 0.3.0 -> BuildSource.md not found, using '-'
140. Processing tag: 0.2.0 -> BuildSource.md not found, using '-'
141. Processing tag: 0.1.0 -> BuildSource.md not found, using '-'
142. Processing tag: 0.0.12-beta -> BuildSource.md not found, using '-'
143. Processing tag: 0.0.11-beta -> BuildSource.md not found, using '-'
144. Processing tag: 0.0.10-beta -> BuildSource.md not found, using '-'
145. Processing tag: 0.0.9-beta -> BuildSource.md not found, using '-'
146. Processing tag: 0.0.8-beta -> BuildSource.md not found, using '-'
147. Processing tag: 0.0.7-beta -> BuildSource.md not found, using '-'
148. Processing tag: 0.0.6-beta -> BuildSource.md not found, using '-'
149. Processing tag: 0.0.5-beta -> BuildSource.md not found, using '-'
150. Processing tag: 0.0.4-beta -> BuildSource.md not found, using '-'
151. Processing tag: 0.0.3-beta -> BuildSource.md not found, using '-'
152. Processing tag: 0.0.2-beta -> BuildSource.md not found, using '-'
153. Processing tag: 0.0.1-beta -> BuildSource.md not found, using '-'
CSV written to timescaledb_postgres_matrix.csv

(.venv) D:\work-soft\python\timescaledb_version_matrix\src>    

まだ、こちらの方が信憑性がありそうですな。

何と言うか「https://github.com/timescale/timescaledb/blob/x.y.z/docs/BuildSource.md」がない時代が暗黒時代過ぎるんだが...

やはり、公式で「バージョン」の対応表は公開して欲しいのよね...

毎度モヤモヤ感が半端ない…

今回はこのへんで。