2012-04-21
| ||
00:31 | Merge the latest trunk changes into the WinRT branch (fixes for tickets [2a5629202f] and [385a5b56b9]). (check-in: 25478dcff5 user: mistachkin tags: winrt) | |
2012-04-20
| ||
17:44 | • Closed ticket [385a5b56]: A DISTINCT SELECT optimized using a UNIQUE index may allow duplicate NULL values. plus 3 other changes (artifact: 40ce6655a4 user: dan) | |
17:27 | • Ticket [385a5b56]: 1 change (artifact: 2a938c789f user: dan) | |
16:59 | Do not consider a DISTINCT clause redundant unless a subset of the result-set is collectively subject to a UNIQUE constraint and it can be guaranteed that all columns of the subset are NOT NULL (either due to NOT NULL constraints WHERE clause terms). Fix for [385a5b56b9]. (check-in: 7b8548b187 user: dan tags: trunk) | |
16:53 | • Ticket [385a5b56] A DISTINCT SELECT optimized using a UNIQUE index may allow duplicate NULL values. status still Open with 1 other change (artifact: f67e8bb0be user: dan) | |
16:03 | • Ticket [385a5b56]: 1 change (artifact: 9955b5ab1e user: dan) | |
16:03 | • Ticket [385a5b56]: 1 change (artifact: fa0c01c6b9 user: dan) | |
16:03 | • Ticket [385a5b56]: 3 changes (artifact: d9f8fa19b0 user: dan) | |
16:02 | • New ticket [385a5b56]. (artifact: 29daf903c1 user: dan) | |
Ticket Hash: | 385a5b56b989ce6f65e859386f932c2c8db65b5c | ||
Title: | A DISTINCT SELECT optimized using a UNIQUE index may allow duplicate NULL values. | ||
Status: | Closed | Type: | Code_Defect |
Severity: | Critical | Priority: | Immediate |
Subsystem: | Code_Generator | Resolution: | Fixed |
Last Modified: | 2012-04-20 17:44:18 | ||
Version Found In: |
Description: | ||||
Currently, SQLite assumes that if the result-set of a SELECT DISTINCT query is collectively subject to a UNIQUE constraint, the DISTINCT qualifier is redundant.
However, this is only true if there are no NULL values in the result set, as NULL values are considered distinct for the purposes of UNIQUE constraints, but identical for the purposes of DISTINCT processing. For example: SQLite version 3.7.12 2012-04-20 15:24:53 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> CREATE TABLE t1(x, y); sqlite> INSERT INTO t1 VALUES(NULL, 'row'); sqlite> INSERT INTO t1 VALUES(NULL, 'row'); sqlite> SELECT DISTINCT x, y FROM t1; |row sqlite> CREATE UNIQUE INDEX i1 ON t1(x, y); sqlite> SELECT DISTINCT x, y FROM t1; |row |row sqlite> dan added on 2012-04-20 17:27:06: dan added on 2012-04-20 17:44:18: |