fixed benchmark
continuous-integration/drone/push Build is passing

This commit is contained in:
2026-04-20 16:24:48 +10:00
parent 8ccf5a7009
commit aa0d8099c7
5 changed files with 156 additions and 8 deletions
+24
View File
@@ -0,0 +1,24 @@
package db
import (
"strings"
"testing"
)
func TestBuildDailySummaryInsertDoesNotGroupFinalAggJoin(t *testing.T) {
query, err := BuildDailySummaryInsert("inventory_daily_summary_20260101", "SELECT 1")
if err != nil {
t.Fatalf("BuildDailySummaryInsert failed: %v", err)
}
if !strings.Contains(query, `FROM agg
JOIN totals ON totals."Vcenter" = agg."Vcenter";`) {
t.Fatalf("expected final agg/totals join with terminator, query tail changed unexpectedly")
}
if strings.Contains(query, `FROM agg
JOIN totals ON totals."Vcenter" = agg."Vcenter"
GROUP BY`) {
t.Fatalf("unexpected final GROUP BY after agg/totals join; this breaks Postgres SQLSTATE 42803")
}
}