Commit Graph

2911 Commits

Author SHA1 Message Date
Pekka Enberg
e4d4e5cd5d Merge 'Streamline dependencies to build for all wasm targets' from Doug A
In order [experimentally
compile](https://github.com/DougAnderson444/wit-limbo) `limbo_core` to a
[wasm component](https://component-model.bytecodealliance.org/), limbo
needed to have no reliance on `js`, `js-sys`, `wasm-bindgen`, et al.
(for those who aren't familiar, there are many `wasm` runtimes and not
all of them play nice with `wasm-bindgen`)
This PR simply cleans up the dependencies, and puts them behind optional
flags and whatnot in order to enable this. Both `log` and `tracing` were
being used, so I reduced this only to `tracing`.
End result is limbo can be used like this:
https://github.com/DougAnderson444/wit-limbo
We can open a discussion on the possibilities that running limbo as a
wasm component can offer, including potentially using composable
components to implement the sqlite runtime extensions, as well as giving
us a clean interface for PlatformIO operations -- define them once,
implement many ways on various platforms. I'm new to limbo, but it looks
like current extension are Rust based deps and features flags, whereas
sqlite is runtime, right? What if limbo was runtime extensible too?
The WIT interface is largely sync (though I believe wasmtime has an
async feature), but in my limited exposure to limbo so far a lot of the
wasm seems sync already anyway. Again, topic for further discussion.
Suffice to say, aligning these deps in this way paves the road for
further experiments and possibilities.
Related: https://github.com/neilg63/julian_day_converter/pull/2
Related: https://github.com/tursodatabase/limbo/issues/950
Closes: https://github.com/tursodatabase/limbo/issues/950

Closes #983
2025-02-12 09:24:04 +02:00
Pekka Enberg
cc4ecf43c4 Merge 'extensions/regexp: Add support for regexp_replace()' from lgualtieri75
Reviewed-by: Preston Thorpe (@PThorpe92)

Closes #986
2025-02-12 09:21:52 +02:00
Pekka Enberg
11970d9c0e Merge 'simulator: --differential mode against SQLite' from Alperen Keleş
Closes #987
2025-02-12 09:15:57 +02:00
Pekka Enberg
e48c50faf6 Merge 'cli: Fix infinite loop on non-terminated literal' from Ihor Andrianov
Bug: Infinite loop when parsing unclosed string literal
To reproduce:
Run query: `SELECT max(';`
Current behavior:
- Query runner enters an infinite loop when encountering an unclosed
string literal and prints error
Fix:
- Throw error and stop query runner loop
Closes #988

Closes #989
2025-02-12 09:14:35 +02:00
Pekka Enberg
807446b5fe Merge 'bindings/java: Rename package name tech.turso' from Kim Seon Woo
This PR is to prepare for uploading limbo-jdbc to maven
Refer to this [issue](https://github.com/tursodatabase/limbo/issues/943)

Closes #990
2025-02-12 09:00:58 +02:00
Pekka Enberg
bb8ab4088b github: Update to "ubuntu-22.04" image
Github is removing support for "ubuntu-20.04" soon so let's migrate to a
newer version.
2025-02-12 08:57:30 +02:00
Pekka Enberg
7e3aaaec83 Merge 'cli: Add newline characters on multiline prompts' from Konstantinos Artopoulos
Fixes #980

Closes #985
2025-02-12 08:42:16 +02:00
김선우
14280680c0 Apply rust lint 2025-02-12 10:36:43 +09:00
Ihor Andrianov
c427c46cd2 clippy 2025-02-12 03:35:16 +02:00
김선우
cb7bd3d211 Change package name from org.github.tursodatabase to tech.turso 2025-02-12 09:58:25 +09:00
Ihor Andrianov
287c04bde0 remove repeated code 2025-02-12 02:34:13 +02:00
Ihor Andrianov
a5fcbed21a fix infinite loop error 2025-02-12 00:10:56 +02:00
alpaylan
babf33bafa fix formatting 2025-02-11 14:15:00 -05:00
alpaylan
c133bbdd29 add differential testing against rusqlite 2025-02-11 14:13:14 -05:00
l.gualtieri
6bd40f0507 Add support for REGEXP_REPLACE in limbo extension #740 2025-02-11 20:04:59 +01:00
Konstantinos Artopoulos
16ae7cdc35 fix(cli): add newline characters on multiline prompts 2025-02-11 18:20:35 +02:00
Doug Anderson444
1903914688 add js feature to nodejs build 2025-02-11 12:13:46 -04:00
Pekka Enberg
ebceefacde Merge 'simulator: add NoREC testing property' from Alperen Keleş
NoREC is a correctness property for testing optimizers, proposed by
Rigger and Su in [Detecting Optimization Bugs in Database Engines via
Non-Optimizing Reference Engine
Construction](https://www.manuelrigger.at/preprints/NoREC.pdf)
This PR adds a NoREC property to the tester.

Closes #973
2025-02-11 17:44:56 +02:00
Pekka Enberg
4c064790b2 Merge 'simulator: add DROP TABLE <t> support' from Alperen Keleş
I wanted to assist the current development in an up-to-date fashion,
this PR adds drop table(which is being implemented currently in
https://github.com/tursodatabase/limbo/pull/897) testing support to the
generator.
Unfortunately, we don't have feature flags in the simulator yet, so the
users should manually fix the generation probability in
`simulator/generation/plan.rs#L644` and
`simulator/generation/property.rs#L629`.

Closes #949
2025-02-11 17:44:49 +02:00
Pekka Enberg
3dd49855d0 Merge 'testing/extensions: Fix tests on macOS' from meteorgan
fix the extensions tests on MacOS

Reviewed-by: Preston Thorpe (@PThorpe92)

Closes #982
2025-02-11 17:41:37 +02:00
meteorgan
7a7c70f8e1 test(extensions): remove the extension suffix so that it can be run on MacOS 2025-02-11 21:45:39 +08:00
Doug Anderson444
35ee14f3bb commit lockfile 2025-02-11 09:08:05 -04:00
Doug Anderson444
2566577b70 libc dep only when io_uring feature 2025-02-11 09:06:26 -04:00
Doug Anderson444
39c3b135e3 make all serde optional
to reduce dep size
2025-02-11 09:05:34 -04:00
Doug Anderson444
0aa5de6d9f rm log, switch all to tracing 2025-02-11 09:03:36 -04:00
Pekka Enberg
cafdef8332 Merge 'core: Add default column name' from wyhaya
Fix #926
```
limbo> select 1, 2, 1+2*3, 'Hello';
┌───┬───┬───────────┬─────────┐
│ 1 │ 2 │ 1 + 2 * 3 │ 'Hello' │
├───┼───┼───────────┼─────────┤
│ 1 │ 2 │         7 │ Hello   │
└───┴───┴───────────┴─────────┘
```

Closes #979
2025-02-11 09:59:23 +02:00
wyhaya
351a032cc1 core: Add default column name 2025-02-11 07:03:51 +00:00
Pekka Enberg
cd27068807 Merge 'cli: Add .exit command' from wyhaya
This PR add the `.exit ?<CODE>` command, which will allow limbo to exit
with the specified code (similar to SQLite3 and DuckDB).
```bash
echo '.exit' | cargo run -p limbo ; echo $?
# ...
# 0

echo '.exit 1' | cargo run -p limbo ; echo $?
# ...
# 1
```

Reviewed-by: Preston Thorpe (@PThorpe92)

Closes #978
2025-02-11 07:59:59 +02:00
Pekka Enberg
cca8ef9e6b Merge 'cli: handle remaining input on EOF' from Konstantinos Artopoulos
Fixes #966

Closes #975
2025-02-11 07:55:34 +02:00
wyhaya
2482c03111 cli: Add .exit command 2025-02-11 03:11:42 +00:00
Doug Anderson444
3734870c6b rm old julian dep 2025-02-10 22:00:18 -04:00
Doug Anderson444
0423945803 restrict chrono to no-dfault-features, update julian_day_converter
chrono has default features that are incompatible with some targets, such as non-js WebAssembly.

Removing the unused defaults allows limbo to compile to these targets
2025-02-10 21:58:34 -04:00
Konstantinos Artopoulos
839e1ce3e8 fix(cli): handle remaining input on EOF 2025-02-11 00:02:20 +02:00
alpaylan
747b6d15e3 add NoREC optimizer testing property 2025-02-10 15:42:49 -05:00
Pekka Enberg
1da43266e9 Merge 'Json path refine' from Ihor Andrianov
Hey! I've rebuilt the JSON path parser to make it easier to maintain and
catch more edge cases.
Main stuff:
- Removed pest dependency in favor of hand-written parser
- Better memory usage (pre-allocates space, use Cow)
- Handles quoted keys properly now
- Added tests for weird edge cases
- Added PPState (Shoutout ThePrimeagen)

Closes #970
2025-02-10 19:39:20 +02:00
Pekka Enberg
db3cb131f4 Update README.md 2025-02-10 19:25:43 +02:00
Pekka Enberg
a531f635cf Update README.md 2025-02-10 19:11:28 +02:00
Pekka Enberg
0e2c9f9b53 Update README.md
Add links to package repositories.
2025-02-10 18:53:37 +02:00
Pekka Enberg
b75629e5af Merge 'bindings/java: Implement DatabaseMetaData ' from Kim Seon Woo
## Purpose of this PR
- Implement `DatabaseMetaData`
## Changes
- Add `JDBC4DatabaseMetaData` which implements minimal
`DatabaseMetaData`
## Note
- This has to be merged after
https://github.com/tursodatabase/limbo/pull/916
## Reference
- [Issue](https://github.com/tursodatabase/limbo/issues/615)

Closes #944
2025-02-10 17:39:59 +02:00
Pekka Enberg
199193588e Merge 'Fix floating point truncation in JSON #877' from lgualtieri75
Fixes #877

Closes #967
2025-02-10 17:38:59 +02:00
김선우
29e023ac79 Merge branch 'main' into java-bindings-database-metadata 2025-02-10 23:00:02 +09:00
Ihor Andrianov
b8b0f860d7 clippy 2025-02-10 15:34:47 +02:00
Ihor Andrianov
aad0522f56 refactor to make parser more readable 2025-02-10 15:13:36 +02:00
Ihor Andrianov
a10955cbcf refine quoted key handling, add RawString option for SQLite compat 2025-02-10 15:12:07 +02:00
Ihor Andrianov
ee16c49c6c add support for quoted path 2025-02-10 15:09:27 +02:00
Ihor Andrianov
f84a6b878a fixed edge cases and add some tests, remove pest grammar 2025-02-10 15:09:26 +02:00
Ihor Andrianov
166532cc81 simplify json path parsing 2025-02-10 15:09:23 +02:00
l.gualtieri
3487969c40 fix floating point numbers get truncated in json #877 2025-02-10 12:23:43 +01:00
Pekka Enberg
8f49024dd1 Fix build_text() call site to use new API 2025-02-10 13:07:19 +02:00
Pekka Enberg
5205c23eed Merge 'Initial support for WITH clauses (common table expressions)' from Jussi Saurio
Adds initial limited support for CTEs.
- No MATERIALIZED
- No RECURSIVE
- No named CTE columns
- Only SELECT statements supported inside CTE
Basically this kind of WITH clause can just be rewritten as a subquery,
so this PR adds some plumbing to rewrite them using the existing
subquery machinery.
It also introduces the concept of a `Scope` where a child query can
refer to its parent, useful for CTEs like:
```
do_execsql_test nested-subquery-cte {
    with nested_sub as (
        select concat(name, '!!!') as loud_hat
        from products where name = 'hat'
    ),
    sub as (
        select upper(nested_sub.loud_hat) as loudest_hat from nested_sub
    )
    select sub.loudest_hat from sub;
} {HAT!!!}
```
I think we need to expand the use of `Scope` to all of our identifier
resolutions (currently we don't explicitly have logic for determining
what a given query can see), but I didn't want to bloat the PR too much.
Hence, this implementation is probably full of all sorts of bugs, but
I've added equivalent tests for ALL the existing subquery tests,
rewritten in CTE form.

Closes #920
2025-02-10 12:15:07 +02:00