cc5381e539ecba5b07109b194acf1d76b0c8f641 braney Thu Jul 23 06:22:48 2026 -0700 Guard hDbForTaxon() callers against curated hub (GenArk) db names. hDbForTaxon() can now return a GenArk-only assembly with no real SQL database, which would abort in sqlConnect()/"use <db>"/cross-db sqlTableExists(). Treat a hubConnectIsCurated() db as no usable native db in uniProtAccToDb(), bacProbeInfo(), and getKnownGeneUrl(). refs #37909 diff --git src/hg/visiGene/hgVisiGene/printCaption.c src/hg/visiGene/hgVisiGene/printCaption.c index 27c274d39c5..74ee2f068d9 100644 --- src/hg/visiGene/hgVisiGene/printCaption.c +++ src/hg/visiGene/hgVisiGene/printCaption.c @@ -1,58 +1,65 @@ /* printCaption - query database for info and print it out * in a caption. */ /* Copyright (C) 2013 The Regents of the University of California * See kent/LICENSE or http://genome.ucsc.edu/license/ for licensing information. */ #include "common.h" #include "hash.h" #include "dystring.h" #include "jksql.h" #include "cart.h" #include "htmshell.h" #include "hdb.h" +#include "hubConnect.h" #include "visiGene.h" #include "hgVisiGene.h" #include "captionElement.h" #include "printCaption.h" struct probeAndColor /* Just a little structure to store probe and probeColor. */ { struct probeAndColor *next; int probe; /* Probe id. */ int probeColor; /* ProbeColor id. */ }; char *getKnownGeneUrl(struct sqlConnection *conn, int geneId) /* Given gene ID, try and find known gene on browser in same * species. */ { char query[256]; char tableName[256]; int taxon; char *url = NULL; char *genomeDb = NULL; /* Figure out taxon. */ sqlSafef(query, sizeof(query), "select taxon from gene where id = %d", geneId); taxon = sqlQuickNum(conn, query); genomeDb = hDbForTaxon(taxon); +/* hDbForTaxon may return a curated hub (GenArk) assembly with no real SQL + * database. genomeDb is used below in cross-database references passed to + * sqlTableExists(), which aborts on an "unknown database" error rather than + * returning FALSE. Treat a hub db name as no usable native db. */ +if (genomeDb != NULL && hubConnectIsCurated(genomeDb)) + genomeDb = NULL; if (genomeDb != NULL) { /* Make sure known genes track exists - we may need * to tweak this at some point for model organisms. */ safef(tableName, sizeof(tableName), "%s.knownToVisiGene", genomeDb); if (!sqlTableExists(conn, tableName)) genomeDb = NULL; } /* If no db for that organism revert to human. */ if (genomeDb == NULL) genomeDb = hDefaultDb(); safef(tableName, sizeof(tableName), "%s.knownToVisiGene", genomeDb); if (sqlTableExists(conn, tableName))