cznic / ql

github.com/cznic/ql has moved to modernc.org/ql
https://godoc.org/modernc.org/ql
BSD 3-Clause "New" or "Revised" License
1.31k stars 75 forks source link

invalid operation: y == x (mismatched types ... ) #190

Closed cryptix closed 6 years ago

cryptix commented 6 years ago

Hi,

I encountered this problem after updating our dependencies. I'm unsure when it was introduced but could pin it down to a last working revision if that information is needed.

It seems to be related to the order in which arguments are passed down. tx.Exec(a,b,c) throws the error in the title but if i shuffle the arguments in the query around it suddenly works.

I posted code to produce the issues in this gist which throws the following error for me:

panic: invalid operation: 11 == 0.4 (mismatched types int64 and float64)

goroutine 1 [running]:
main.check(0xc12780, 0xc4201539f0)
    /home/user/go/src/test/main.go:12 +0x4a
main.main()
    /home/user/go/src/test/main.go:99 +0x939
exit status 2
cznic commented 6 years ago

I've just locally updated all ql dependecies and tested master at tip https://github.com/cznic/ql/commit/8c32ff10fdc2810e93a6e127119d95545497909e. go test passes cleanly. Please provide a recipe how to reproduce the failure, thank you.

jnml@4670:~/src/github.com/cznic/ql> go get -u -v
github.com/cznic/ql (download)
github.com/cznic/b (download)
github.com/cznic/golex (download)
github.com/cznic/lldb (download)
github.com/cznic/fileutil (download)
github.com/cznic/internal (download)
github.com/cznic/mathutil (download)
github.com/edsrzf/mmap-go (download)
github.com/cznic/sortutil (download)
github.com/cznic/zappy (download)
github.com/cznic/strutil (download)
github.com/cznic/b
github.com/cznic/fileutil
github.com/cznic/zappy
github.com/cznic/ql/vendored/github.com/camlistore/go4/lock
github.com/cznic/internal/file
github.com/cznic/lldb
github.com/cznic/ql
jnml@4670:~/src/github.com/cznic/ql> go test |& tee log
PASS
ok      github.com/cznic/ql 9.684s
jnml@4670:~/src/github.com/cznic/ql> 
cryptix commented 6 years ago

The file in the gist doesn't work for you? I turn it into a PR which makes it a test on the driver package.

cznic commented 6 years ago

Sorry, I'm heavily multitasking right now and completely missed the link. The repro PR is a good idea, go on please. Please add yourself to the AUTHORS/CONTRIBUTORS files, thank you.

cryptix commented 6 years ago

No problem. I know such days very well. See #191.

cznic commented 6 years ago

@cryptix Sorry for the delay.

cryptix commented 6 years ago

de nada! very glad you found the problem.