1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-01 06:27:03 +03:00

Do not apply the optimization that omits DISTINCT if all result terms are

part of a UNIQUE index if the index is also a partial index.
Fix for the bug reported by
[forum:/forumpost/66954e9ece|forum post 66954e9ece].

FossilOrigin-Name: c2f940b02883e165172a4ca21c7095ffbef84ddc5367853dfeca93fda20d6056
This commit is contained in:
drh
2021-04-06 23:29:41 +00:00
parent a74364ae13
commit 204b634222
4 changed files with 18 additions and 8 deletions

View File

@ -293,4 +293,13 @@ do_execsql_test 7.1 {
WHERE (t1.a=t3.a) AND (SELECT count(*) FROM t2 AS y WHERE t4.x!='abc')=t1.a
} {2 2 2}
# 2021-04-06 forum post https://sqlite.org/forum/forumpost/66954e9ece
reset_db
do_execsql_test 8.0 {
CREATE TABLE person ( pid INT) ;
CREATE UNIQUE INDEX idx ON person ( pid ) WHERE pid == 1;
INSERT INTO person VALUES (1), (10), (10);
SELECT DISTINCT pid FROM person where pid = 10;
} {10}
finish_test