I have a table with a 12-column UNIQUE index. \d sales
shows sales_uq UNIQUE, btree (a1, a2, a3, ... a12)
.
I do the following query:
SELECT a1, a2, a3, ... a12 FROM sales GROUP BY a1, a2, a3, ... a12 HAVING count(1) > 1;
and I get a bunch of results. How is that possible?! Is it possible that the index is there but somehow disabled? Or can there be some issue with NULLs? Or with floating point numbers (two of the columns in the index are of type double precision
)?