ca68bb3e12fd5cd9663ae14b79e318c8c4089e63
hiram
  Wed Jun 26 08:43:57 2019 -0700
do not add bin column to sqlSelect when there is no bin column refs #23731

diff --git src/hg/hubApi/getData.c src/hg/hubApi/getData.c
index 637c1f7..6849b4d 100644
--- src/hg/hubApi/getData.c
+++ src/hg/hubApi/getData.c
@@ -247,30 +247,31 @@
 else	/* fully specified chrom:start-end */
     {
     jsonWriteString(jw, "chrom", chrom);
     if (startsWith("wig", tdb->type))
 	{
 	if (jsonOutputArrays || debug)
 	    wigColumnTypes(jw);
 	jsonWriteListStart(jw, chrom);
         itemsReturned += wigTableDataOutput(jw, db, splitSqlTable, chrom, start, end, 0);
 	jsonWriteListEnd(jw);
         return;	/* DONE */
 	}
     else
 	{
 	sqlDyStringPrintf(query, "select * from %s where ", splitSqlTable);
+        if (hti->hasBin)
            hAddBinToQuery(start, end, query);
 	sqlDyStringPrintf(query, "%s='%s' AND %s > %u AND %s < %u ORDER BY %s", chromName, chrom, endName, start, startName, end, startName);
 	}
     }
 
 if (debug)
     jsonWriteString(jw, "select", query->string);
 
 /* continuing, could be wiggle output with no chrom specified */
 char **columnNames = NULL;
 char **columnTypes = NULL;
 int *jsonTypes = NULL;
 struct asObject *as = asForTable(conn, splitSqlTable, tdb);
 struct asColumn *columnEl = as->columnList;
 int asColumnCount = slCount(columnEl);