Steven Russell wrote:
I just grabbed the 3.7.10 amalgamation source and built it, but have run into 
an issue where DISTINCT doesn't appear to actually return distinct values on a 
table that includes a UNIQUE clause.  It unexpectedly returns duplicates 
instead.

My build environment is:

- Mac OS X 10.6.8
- Xcode 3.2.5
- The source is built from within an Xcode project using LLVM GCC 4.2
- As mentioned above, I'm using the amalgamation source

I found a fairly simple repro case using the shell tool (again, built by Xcode 
as above).

% ./sqlite3 :memory:
SQLite version 3.7.10 2012-01-16 13:28:40
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> CREATE TABLE t ( a INTEGER NOT NULL, b INTEGER NOT NULL, UNIQUE (a,b) );
sqlite> INSERT INTO t VALUES(1,1);
sqlite> INSERT INTO t VALUES(2,1);
sqlite> INSERT INTO t VALUES(3,1);
sqlite> INSERT INTO t VALUES(2,2);
sqlite> INSERT INTO t VALUES(3,2);
sqlite> INSERT INTO t VALUES(4,2);
sqlite> SELECT DISTINCT b from t WHERE a IN (1,2,3);
1
2
1
2


I obviously don't expect the duplicate results here.  If you create the table 
without the UNIQUE clause, then the results are as expected (1 and 2 both only 
show up once).

As a point of reference, the sqlite3 shell tool that ships with the OS (3.6.12) 
does produce the correct results.

That's approaching a pretty good "bug" report. However, I would suggest a little more to promote a resolution of this problem. You do not state the compilation options. Optimization settings and preprocessor variable settings are critical for narrowing what is happening. Also, the preprocessor settings may be the whole problem, one which can be quickly diagnosed for you if they are revealed.

For your own resolution, you might try eliminating optimizations. I would want to review docs for the preprocessor settings if this was my problem.

Good luck,
--
Larry Brasfield
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to