Commit 766a498
committed
Support parsing doubly quoted strings as identifiers
Per https://www.sqlite.org/lang_keywords.html, SQLite supports
identifiers expressed as strings surrounded between double quotes:
$ sqlite3
SQLite version 3.52.0 2026-03-06 16:01:44
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> create table a("oh,boy!" TEXT);
sqlite> pragma table_info(a);
╭─────┬─────────┬──────┬─────────┬────────────┬────╮
│ cid │ name │ type │ notnull │ dflt_value │ pk │
╞═════╪═════════╪══════╪═════════╪════════════╪════╡
│ 0 │ oh,boy! │ TEXT │ 0 │ NULL │ 0 │
╰─────┴─────────┴──────┴─────────┴────────────┴────╯
When identifiers are parsed as such, no escaping applies, i.e.
backslashes don't affect the next character:
sqlite> create table b("oh\tno\" TEXT);
sqlite> pragma table_info(b);
╭─────┬─────────┬──────┬─────────┬────────────┬────╮
│ cid │ name │ type │ notnull │ dflt_value │ pk │
╞═════╪═════════╪══════╪═════════╪════════════╪════╡
│ 0 │ oh\tno\ │ TEXT │ 0 │ NULL │ 0 │
╰─────┴─────────┴──────┴─────────┴────────────┴────╯
Make sqlite-vec internal scanner handle these identifiers, so
that the column names in a vec0 virtual table may have the same
(reduced) limitations as any other SQLite table.
Note: SQLite also implements similar support for single quoted
strings to be handled as identifiers. This is done for compatibility
with other SQL implementations rather than standard conformance,
so it's perhaps a bit more dubious to support.1 parent 5778fec commit 766a498
1 file changed
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2157 | 2157 | | |
2158 | 2158 | | |
2159 | 2159 | | |
| 2160 | + | |
| 2161 | + | |
| 2162 | + | |
| 2163 | + | |
| 2164 | + | |
| 2165 | + | |
| 2166 | + | |
| 2167 | + | |
| 2168 | + | |
| 2169 | + | |
| 2170 | + | |
2160 | 2171 | | |
2161 | 2172 | | |
2162 | 2173 | | |
| |||
0 commit comments