SQLite User Forum

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

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

(1) By tanloong on 2025-06-23 11:04:46 [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 [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