Skip to content

Commit fb5ed10

Browse files
committed
fix Where bug from recent changes
1 parent c6b665e commit fb5ed10

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

dbms/query/where.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,7 @@ func (w *Where) setApproach(index []string, frac float64, app any, tran QueryTra
662662
}
663663
if app == nil { // filter
664664
w.source = SetApproach(w.source, index, frac, tran)
665+
w.tbl, _ = w.source.(*Table) // SetApproach may insert TempIndex
665666
} else {
666667
app := app.(*whereApproach)
667668
idx := app.index
@@ -810,7 +811,7 @@ func (w *Where) Rewind() {
810811
}
811812

812813
func (w *Where) Select(cols, vals []string) {
813-
// fmt.Println("Where", w.tbl.name, "Select", cols, unpack(vals))
814+
// fmt.Println("Where Select", cols, unpack(vals))
814815
w.nsels++
815816
w.Rewind()
816817
w.selOrg, w.selEnd = "", ""

full_test.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Copyright Suneido Software Corp. All rights reserved.
12
// Governed by the MIT license found in the LICENSE file.
23

34
package main
@@ -14,6 +15,28 @@ import (
1415
. "github.com/apmckinlay/gsuneido/core"
1516
)
1617

18+
func TestFuzzBug(t *testing.T) {
19+
if testing.Short() {
20+
t.SkipNow()
21+
}
22+
Libload = libload // dependency injection
23+
mainThread.Name = "main"
24+
mainThread.SetSviews(&sviews)
25+
MainThread = &mainThread
26+
openDbms()
27+
defer db.CloseKeepMapped()
28+
29+
result := compile.EvalString(MainThread, `
30+
QueryFuzz.MakeTables(7616220806)
31+
QueryHash("
32+
bln
33+
leftjoin /*MANY TO MANY*/ by(ik)
34+
((ivc where ck isnt '3')
35+
union /*NOT DISJOINT*/
36+
ivc)", details:)`)
37+
fmt.Println(result)
38+
}
39+
1740
func TestFastGet(t *testing.T) {
1841
if testing.Short() {
1942
t.SkipNow()

0 commit comments

Comments
 (0)