penberg / limbo

Limbo is a work-in-progress, in-process OLTP database management system, compatible with SQLite.
MIT License
896 stars 49 forks source link

Basic where clause support #121

Closed jussisaurio closed 1 month ago

jussisaurio commented 1 month ago

Sorry, I didn't realize @Feilkin had expressed interest in implementing this (#80) until I was mostly done... anyway, here's some kind of attempt. My bytecode/assembly-fu is quite basic 🍝

penberg commented 1 month ago

@pereman2 Wanna review this?

penberg commented 1 month ago

@jussisaurio looks like limit 0 test is busted, can you please fix it?

jussisaurio commented 1 month ago

@jussisaurio looks like limit 0 test is busted, can you please fix it?

Isn't it this test: Test FAILED: 'select count(1) from users where 0;' ? Anyway yeah, it returns NULL in this and 0 in sqlite, not sure why

Will take a look tomorrow

penberg commented 1 month ago

@jussisaurio @pereman2 I think once we have the test passing, let's merge this to avoid conflicts. But totally agree on moving the call. Codegen optimizations also make sense

penberg commented 1 month ago

The test itself is just wrong. I suspect you got bitten by the fact that our aggregates was bit broken before but got fixed in 93aefa3ee6b8f5a30a5286c28558556387f8ac4c:

The following fixes the problem:

diff --git a/testing/all.test b/testing/all.test
index 0ab665e..252ae03 100755
--- a/testing/all.test
+++ b/testing/all.test
@@ -117,7 +117,7 @@ do_execsql_test where-clause-unary-true {
 # not correct? should be 0?
 do_execsql_test where-clause-unary-false {
     select count(1) from users where 0;
-} {NULL}
+} {0}

 do_execsql_test where-clause-no-table-unary-true {
     select 1 where 1;

Merging...