e58fa7f310af32cf0b4e3c6037be9baf268c1ef8 braney Fri May 8 08:47:46 2026 -0700 Avoid SQL connect to hub assembly when looking up table info in hgTables, refs #37519 diff --git src/hg/hgTables/hgTables.c src/hg/hgTables/hgTables.c index 563e7a6579e..ef3a10d3249 100644 --- src/hg/hgTables/hgTables.c +++ src/hg/hgTables/hgTables.c @@ -672,30 +672,35 @@ (strchr(table, '.') != NULL && startsWith("myVariants_", strchr(table, '.') + 1))) { /* Accept the qualified myVariants storage form * ("customDataNN.myVariants_") as well as the bare track name; * the ct list is keyed on the bare track name. */ char *dot = strchr(table, '.'); char *trackName = (dot != NULL && startsWith("myVariants_", dot + 1)) ? dot + 1 : table; struct customTrack *ct = ctLookupName(trackName); hti = ctToHti(ct); } else if (sameWord(table, WIKI_TRACK_TABLE)) { hti = wikiHti(); } +else if (trackHubDatabase(db)) + { + /* Hub assemblies have no SQL database; can't look up table via hFindTableInfo. */ + hti = NULL; + } else { char *track; if (startsWith("chrN_", table)) track = table + strlen("chrN_"); else track = table; hti = hFindTableInfo(db, NULL, track); } return(hti); } struct hTableInfo *getHti(char *db, char *table, struct sqlConnection *conn) /* Return primary table info. */ { @@ -957,32 +962,33 @@ { if (sameString(jp->a->field, trackHti->nameField)) { if ( sameString(jp->b->database, db) && sameString(jp->b->table, table) ) { idField = cloneString(jp->b->field); break; } } } joinerPairFreeList(&jpList); } } /* If we haven't found the answer but this looks like a non-positional table, - * use the first field. */ -if (idField == NULL && !isCustomTrack(table) && (hti == NULL || !hti->isPos)) + * use the first field. Skip for hub assemblies, which have no SQL database. */ +if (idField == NULL && !isCustomTrack(table) && (hti == NULL || !hti->isPos) + && !trackHubDatabase(db)) { struct sqlConnection *conn = track ? hAllocConnTrack(db, track) : hAllocConn(db); struct slName *fieldList = sqlListFields(conn, table); if (fieldList == NULL) errAbort("getIdField: Can't find fields of table %s", table); idField = cloneString(fieldList->name); slFreeList(&fieldList); hFreeConn(&conn); } return idField; } int countTableColumns(struct sqlConnection *conn, char *table) /* Count columns in table. */ {