#!/usr/bin/env python3
import os
import psycopg2
from dotenv import load_dotenv

load_dotenv()

conn = psycopg2.connect(
    host=os.getenv('KNOWHUB_DB'),
    port=int(os.getenv('KNOWHUB_PORT', 5432)),
    user=os.getenv('KNOWHUB_USER'),
    password=os.getenv('KNOWHUB_PASSWORD'),
    database=os.getenv('KNOWHUB_DB_NAME')
)
cursor = conn.cursor()

# 查看所有可用扩展
cursor.execute("SELECT * FROM pg_available_extensions WHERE name LIKE '%vector%';")
print("可用的vector扩展:")
for row in cursor.fetchall():
    print(row)

# 查看已安装扩展
cursor.execute("SELECT * FROM pg_extension;")
print("\n已安装的扩展:")
for row in cursor.fetchall():
    print(row)

cursor.close()
conn.close()
