mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-24 19:44:21 +01:00
This PR fixes bugs found in the [turso- go](https://github.com/tursodatabase/turso-go) driver with UPSERT clause earlier, where `Gorm` will (obviously) use Expr::Variable's as well as use quotes for `Expr::Qualified` in the tail end of an UPSERT statement. Example: ```sql INSERT INTO users (a,b,c) VALUES (?,?,?) ON CONFLICT (`users`.`a`) DO UPDATE SET b = `excluded`.`b`, a = ?; ``` and previously we were not properly calling `rewrite_expr`, which was not properly setting the anonymous `Expr::Variable` to `__param_N` named parameter, so it would ignore it completely, then return the wrong # of parameters. Also, we didn't handle quoted "`excluded`.`x`", so it would panic in the optimizer that Qualified should have been rewritten earlier. Closes #3157
Turso Testing
Testing Extensions
When adding tests for extensions, please follow these guidelines:
- Tests that verify the internal logic or behavior of a particular extension should go into
cli_tests/extensions.py. - Tests that verify how extensions interact with the database engine, such as virtual table handling, should be written
in TCL (see
vtab.testas an example).
To check which extensions are available in TCL, or to add a new one, refer to the tester.tcl file and look at the extension_map.