fix: use raw RDB$FIELD_NAME key instead of alias for Firebird metadata query

This commit is contained in:
Lizandro Guarnizo
2026-07-17 10:18:10 -05:00
parent 6235b1539c
commit e185095e28
+2 -2
View File
@@ -26,7 +26,7 @@ async def listar_diagnosticos(
# Estructura de la tabla # Estructura de la tabla
ok_c, _, cols = fb.execute_query( ok_c, _, cols = fb.execute_query(
"SELECT TRIM(f.RDB$FIELD_NAME) AS col " "SELECT f.RDB$FIELD_NAME "
"FROM RDB$RELATION_FIELDS f " "FROM RDB$RELATION_FIELDS f "
"WHERE TRIM(f.RDB$RELATION_NAME) = 'DIAGNOSTICO' " "WHERE TRIM(f.RDB$RELATION_NAME) = 'DIAGNOSTICO' "
"ORDER BY f.RDB$FIELD_POSITION", None "ORDER BY f.RDB$FIELD_POSITION", None
@@ -58,7 +58,7 @@ async def listar_diagnosticos(
return JSONResponse({ return JSONResponse({
"ok": True, "ok": True,
"total": cnt[0]["TOTAL"] if ok_n and cnt else "?", "total": cnt[0]["TOTAL"] if ok_n and cnt else "?",
"columnas": [c["col"] for c in cols] if ok_c and cols else [], "columnas": [list(c.values())[0].strip() for c in cols] if ok_c and cols else [],
"limite": limit, "limite": limit,
"filtro": q or None, "filtro": q or None,
"rows": [{"cod": r["cod"], "concepto": r["concepto"]} for r in (rows or [])], "rows": [{"cod": r["cod"], "concepto": r["concepto"]} for r in (rows or [])],