Fix startup warnings: use psycopg2.sql.Identifier for ALTER TABLE OWNER (fixes single-quote syntax error), remove player_state indexes (it's a view, not a table)

This commit is contained in:
Reditus committed 2026-05-21 13:41:04 +01:00
1 parent 3e1386e6bd
commit 2d8728edc8
3 files changed
+8 -8

No files matched your search

+3 -1
View File
@@ -36,7 +36,9 @@ class ChatService:
""")
self.db.execute("CREATE INDEX IF NOT EXISTS idx_chat_history_timestamp ON dune.chat_history (timestamp DESC)")
if self.db_owner:
self.db.execute("ALTER TABLE IF EXISTS dune.chat_history OWNER TO %s", (self.db_owner,))
from psycopg2 import sql
owner_ident = sql.Identifier(self.db_owner).as_string(None)
self.db.execute(f"ALTER TABLE IF EXISTS dune.chat_history OWNER TO {owner_ident}")
self.ensured_table = True
logger.info("Chat history table ready")
return True