Files
turso/sqlite/parser
Pekka Enberg dc2b3383a4 core: report name collisions on CREATE the way SQLite does
SQLite reports a duplicate CREATE TABLE/VIEW/TRIGGER by echoing the new
object's name token exactly as written, quotes included: `CREATE TABLE
"t2"` fails with `table "t2" already exists`. Duplicate index names are
reported without quotes (`index idx1 already exists`), and a clash
between the index and table namespaces gets its own shape ("there is
already an index named x" / "there is already a table named x"). Turso
stripped quotes everywhere and used its own spellings ("Trigger t
already exists", "Table t already exists" for virtual tables, "Error:
index with name 't' already exists.", and a runtime backstop that
always double-quoted the name).

The parser now remembers bracket quoting in ast::Name (previously
`[t]` lost its brackets and re-rendered double-quoted), so
Name::as_ident can reproduce any quoted token as written. A new
util::identifier_token_for_error wraps that for error messages, and the
schema-level conflict backstop takes the kind of object being created
so it can pick between the "already exists" and "there is already a..."
shapes.

Tests: sqlite/conformance/sqlite-sqltests/already-exists-error-message.sqltest
(9 of 12 cases fail without this change); testing/system/vtab.test
expectations updated to the SQLite spelling.
2026-08-11 12:35:48 +03:00
..
…

TODO