SQLite

View Ticket
Login
2014-08-06
00:29 Fixed ticket [3a88d85f]: Segfault when a DEFAULT value contains an aggregate function plus 5 other changes (artifact: 62aee611 user: drh)
00:29
A simpler fix for ticket [3a88d85f36704eebe1] - one that uses less code. The error message is not quite as good, but as this error has apparently not previously occurred in over 8 years of heavy use, that is not seen as a serious problem. (check-in: 0ad1ed8e user: drh tags: trunk)
2014-08-05
21:31
Ensure that aggregate functions are not used when evaluating a default value for a table column. Candidate fix for ticket [3a88d85f36704eebe134f7]. (check-in: 29ba8128 user: drh tags: trunk)
20:51 New ticket [3a88d85f] Segfault when a DEFAULT value contains an aggregate function. (artifact: fcc55ce4 user: drh)

Ticket Hash: 3a88d85f36704eebe134f7f48aebf00cd6438c1a
Title: Segfault when a DEFAULT value contains an aggregate function
Status: Fixed Type: Code_Defect
Severity: Important Priority: Immediate
Subsystem: Unknown Resolution: Fixed
Last Modified: 2014-08-06 00:29:20
Version Found In: 3.8.5
User Comments:
drh added on 2014-08-05 20:51:51:

The following SQL script segfaults while running the INSERT statement:

CREATE TABLE t1(x DEFAULT(max(1)));
INSERT INTO t1(rowid) VALUES(1);

The problem appears to be the use of an aggregate function as part of the default value for a column. This problem has been in the code since at least 2006-01-01 and probably before that. This problem was detected and reported on the sqlite-users@sqlite.org mailing list by Zsbán Ambrus.