Ticket Hash: | b5ca442af9fadf5eff5b2bf64839516ab82cfc3d | |||
Title: | "Malformed database schema" when creating a failing index within a transaction | |||
Status: | Closed | Type: | Code_Defect | |
Severity: | Cosmetic | Priority: | Immediate | |
Subsystem: | Unknown | Resolution: | Fixed | |
Last Modified: | 2019-05-21 14:46:52 | |||
Version Found In: | 3.28 | |||
User Comments: | ||||
mrigger added on 2019-05-21 10:04:03:
(text/x-fossil-wiki)
It seems that an integer overflow that occurs when creating an index does not prevent the index from being created, when the <i>CREATE</i> statement is executed as part of an explicit transaction: <pre> CREATE TABLE IF NOT EXISTS t0(c0); INSERT INTO t0(c0) VALUES (-9223372036854775808); BEGIN TRANSACTION; CREATE INDEX i0 ON t0(ABS(c0)); -- integer overflow (expected) COMMIT; -- unexpected: the index is still created CREATE INDEX i0 ON t0(1); -- malformed database schema (i0) - index i0 already exists </pre> That the schema is malformed can also be verified by <i>pragma integrity_check</i>. Without the <i>BEGIN TRANSACTION</i> and <i>COMMIT</i>, the index is not created as expected. mrigger added on 2019-05-21 10:20:27: (text/x-fossil-wiki) This bug seems serious, since the index can also not be dropped: <pre> CREATE TABLE IF NOT EXISTS t0(c0); INSERT INTO t0(c0) VALUES (-9223372036854775808); BEGIN TRANSACTION; CREATE INDEX i0 ON t0(ABS(c0)); -- integer overflow (expected) COMMIT; -- unexpected: the index is still created DROP INDEX i0; -- no such index: i0 CREATE INDEX i0 ON t0(1); -- malformed database schema (i0) - index i0 already exists </pre> |