chaisql / chai

Modern embedded SQL database
MIT License
1.56k stars 95 forks source link

ORDER BY results in empty results, cmd query tool #438

Closed mwyvr closed 2 years ago

mwyvr commented 2 years ago

What version of Genji are you using?

$ genji version
Genji v0.14.0
Genji CLI v0.14.0

Same behaviour with Boltdb/Badgerdb. To be clear, this is only in the genji cmd tool; I'm not seeing issues using the Genji API.

What did you do?

Using the command line query tool:

Example data:

select * from person limit 1; { "sid": "af879a5vfpdad6wd", "firstname": "Bolt0", "lastname": "Smith", "primaryemail": "foo-0@example.com" }

Example query without ORDER BY genji> select sid, firstname from person limit 5; { "sid": "af879a5vfpdad6wd", "firstname": "Bolt0" } { "sid": "af879a5vfpdad6we", "firstname": "Bolt1" } { "sid": "af879a5vftdad6wf", "firstname": "Bolt2" }

What did you expect to see?

5 documents, ordered ASC or DESC

What did you see instead?

FAILing query - it doesn't matter what field or direction the order by is issued, always empty N results. genji> select sid, firstname from person ORDER BY sid limit 5; {} {} {} {} {}

asdine commented 2 years ago

Thanks for reporting, I managed to reproduce it. I'll investigate and release a fix soon

asdine commented 2 years ago

This has been fixed by v0.14.1, you can run:

go get github.com/genjidb/genji@latest
go install github.com/genjidb/genji/cmd/genji@latest