3a98f0a9c8b6e1771f09cd38d2cf68a7a691c860
hiram
  Mon Mar 1 08:22:44 2021 -0800
need to use the appropriate chrom name column when getting full table refs #25840

diff --git src/hg/hubApi/getData.c src/hg/hubApi/getData.c
index 48471ed..d4c4ddc 100644
--- src/hg/hubApi/getData.c
+++ src/hg/hubApi/getData.c
@@ -272,34 +272,34 @@
 if (isEmpty(chrom))
     {
     jsonWriteObjectStart(jw, track);	/* begin track data output */
     char fullTableName[256];
     struct chromInfo *ciList = createChromInfoList(NULL, db);
     slSort(ciList, chromInfoCmp);
     struct chromInfo *ci = ciList;
     for ( ; ci && itemsDone < maxItemsOutput; ci = ci->next )
 	{
 	jsonWriteListStart(jw, ci->chrom);	/* starting a chrom output */
 	freeDyString(&query);
 	query = dyStringNew(64);
 	if (hti && hti->isSplit) /* when split, make up split chr name */
 	    {
 	    safef(fullTableName, sizeof(fullTableName), "%s_%s", ci->chrom, hti->rootName);
-	    sqlDyStringPrintf(query, "select * from %s where chrom='%s'", fullTableName, ci->chrom);
+	    sqlDyStringPrintf(query, "select * from %s where %s='%s'", fullTableName, chromName, ci->chrom);
 	    }
 	else
-	    sqlDyStringPrintf(query, "select * from %s where chrom='%s'", splitSqlTable, ci->chrom);
+	    sqlDyStringPrintf(query, "select * from %s where %s='%s'", splitSqlTable, chromName, ci->chrom);
 	if (tdb && isWiggleDataTable(tdb->type))
             itemsDone += wigTableDataOutput(jw, db, splitSqlTable, chrom,
 		start, end, itemsDone);
 	else
 	    itemsDone += sqlQueryJsonOutput(conn, jw, query->string,
 		columnCount, columnNames, jsonTypes, itemsDone);
 	jsonWriteListEnd(jw);	/* chrom data output list end */
 	}
     if (itemsDone >= maxItemsOutput)
 	reachedMaxItems = TRUE;
     jsonWriteObjectEnd(jw);	/* end track data output */
     itemsReturned += itemsDone;
     }
 else
     {	/* a single chrom has been requested, run it */