SQLite User Forum

[fixed] Bug: `.tables` needs to escape the underscore in `WHERE name NOT LIKE sqlite_%`
Login

[fixed] Bug: `.tables` needs to escape the underscore in `WHERE name NOT LIKE sqlite_%`

(1.1) By tanloong on 2025-06-28 15:15:50 edited from 1.0 [source]

Object names starting with "sqlite_" are reserved for internal use and filtered from .tables output in the CLI: https://github.com/sqlite/sqlite/blob/master/src/shell.c.in#L11499

However, _ in LIKE patterns matches any single character (including literal underscores). To prevent false filtering of table names like sqlitee (though rare in practice), we need to escape the underscore:

WHERE name NOT LIKE 'sqlite_%' ESCAPE '_'

(2) By Bo Lindbergh (_blgl_) on 2025-06-23 17:52:43 in reply to 1.0 [link] [source]

Would have been fixed by this commit if there hadn't been a typo on line 10808.

sqlite> .schema --nosys
Error: near "ESCALE": syntax error

(3) By Trudge on 2025-06-29 15:31:13 in reply to 2 [link] [source]

Good one. I hate it when someone moves the keys around on my keyboarf.