import psycopg2

conn = psycopg2.connect(host="192.168.1.76", port=5432, user="vladimir.buzalka",
                        password="Vlado7309208104++", database="fotky_buzalkovi")
cur = conn.cursor()

cur.execute("SELECT table_name FROM information_schema.tables WHERE table_schema='public' ORDER BY table_name")
print("Tabulky:")
for r in cur.fetchall():
    print(f"  {r[0]}")

cur.execute("SELECT indexname FROM pg_indexes WHERE schemaname='public' ORDER BY indexname")
print("Indexy:")
for r in cur.fetchall():
    print(f"  {r[0]}")

cur.execute("""
    SELECT column_name, data_type, is_nullable
    FROM information_schema.columns
    WHERE table_schema='public' AND table_name='zdrojove_soubory'
    ORDER BY ordinal_position
""")
print("\nSloupce zdrojove_soubory:")
for r in cur.fetchall():
    print(f"  {r[0]:20s}  {r[1]:20s}  nullable={r[2]}")

conn.close()
