997a9384be1a820ea0c35e2b551308bd6b5fb771 braney Tue Aug 18 09:08:34 2026 -0700 hdb: drop limit 1 from the hDbForTaxon fallback query so all candidate dbs are checked The fallback query returned a single row, so the loop in firstExistingDbFromQuery had nothing to walk. If that one dbDb row had no real SQL database and no curated hub, hDbForTaxon returned NULL. Without the limit the loop sees every active row for the taxon in orderKey order and returns the first one that exists. refs #17886 diff --git src/hg/lib/hdb.c src/hg/lib/hdb.c index 726e57f1455..910a3a8922b 100644 --- src/hg/lib/hdb.c +++ src/hg/lib/hdb.c @@ -620,31 +620,31 @@ // First try defaultDb. Watch out for taxIds with multiple genomes (and hence multiple // defaultDb matches). For example, 9606 (human) has patch databases, each with a different // genome. Favor the "real" genome using orderKey and make sure databases are active in dbDb. sqlSafef(query, sizeof(query), "select d.name from %s d, %s f " "where d.taxId = %d and d.name = f.name " "and active = 1 order by orderKey", dbDbTable(), defaultDbTable(), taxon); db = firstExistingDbFromQuery(centralConn, query); // Rarely, we have one genome (like Baboon) that actually encompasses different species // and taxons (P. anubis and P. hamadryas). defaultDb only has one (P. anubis), so the // query comes up empty for the other. If so, try again using orderKey instead of defaultDb: if (isEmpty(db)) { sqlSafef(query, sizeof(query), - "select name from %s where taxId = %d and active = 1 order by orderKey limit 1", + "select name from %s where taxId = %d and active = 1 order by orderKey", dbDbTable(), taxon); db = firstExistingDbFromQuery(centralConn, query); } hDisconnectCentral(¢ralConn); } return db; } char *hDefaultDb() /* Return the default db if all else fails */ { char *genome = cfgOptionDefault("defaultGenome", DEFAULT_GENOME); return hDefaultDbForGenome(genome); }