#!/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()

# 查看fastann的函数和操作符
cursor.execute("""
    SELECT proname, prosrc FROM pg_proc
    WHERE proname LIKE '%fastann%' OR proname LIKE '%ann%'
    LIMIT 20;
""")
print("fastann相关函数:")
for row in cursor.fetchall():
    print(f"  {row[0]}")

cursor.close()
conn.close()
