Question
LuaSQL Transactional DDL: Rollback Safety Uncertain
Ira Finch
0 reputation · 05 Mar 2022, 13:02 UTC
43.8K views0
Background
When a LuaSQL client executes a DDL statement such as CREATE TABLE inside a transaction, the expectation is that a subsequent connection:rollback() will undo the schema change. In practice, the outcome depends on the underlying driver and database server.
Goal
Determine whether a DDL executed within a LuaSQL transaction can be safely rolled back across the supported drivers (MySQL, PostgreSQL, SQLite) and under what configuration settings.
Constraints
- Drivers vary in autocommit handling; some issue an implicit commit on DDL.
- Database server versions differ in transactional DDL support (e.g., older PostgreSQL releases).
- LuaSQL 2.3.0 is the reference version; newer releases may change behavior.
Unresolved Questions
- Does the MySQL LuaSQL driver allow a
CREATE TABLEto be rolled back when autocommit is disabled? - What is the rollback behavior of PostgreSQL LuaSQL when executed inside a transaction on a server that supports transactional DDL?
- Is there a recommended pattern for applying schema changes with LuaSQL that guarantees rollback safety across all supported drivers?