On Friday, April 29, 2016 at 11:00:37 AM UTC-7, Aymeric Augustin wrote:
>
> Hi Rich,
>
> On 29 Apr 2016, at 19:52, Rich Rauenzahn >
> wrote:
>
>
> I see now that I need to provide a sentinel value --
> BOO=True,VAL=, or manually create additional unique indexes.
>
>
> Indeed, you should write a
Hi Rich,
> On 29 Apr 2016, at 19:52, Rich Rauenzahn wrote:
>
> I see now that I need to provide a sentinel value -- BOO=True,VAL=,
> or manually create additional unique indexes.
Indeed, you should write a migration with a RunSQL operation that creates a
unique index on boo where boo = true.
On Friday, April 29, 2016 at 2:16:45 AM UTC-7, Anssi Kääriäinen wrote:
>
> If you really, really want an unique index that allows just a single
> value, you might want to try unique index on (a, b, c) where c is not
> null, and another unique index on (a, b) where c is null. That might
> give
On Friday, April 29, 2016 at 12:51:31 AM UTC-7, Florian Apolloner wrote:
>
>
> I am not against a note in the docs, but I find the fact that nulls are
> not "unique" and can exist in an index more than once very useful (fwiw
> ordering after a column with null can also be interesting across
>
If you really, really want an unique index that allows just a single
value, you might want to try unique index on (a, b, c) where c is not
null, and another unique index on (a, b) where c is null. That might
give the results you are looking for, though I haven't tested this.
SQL's nulls are weird,
Hello,
In SQL, defining a unique index on a nullable column will only enforce unicity
of non-null values. This behavior seems more useful than allowing exactly one
null value.
Your example adds two more columns to the index. Other than that, it’s the
exact same situation.
In my opinion, the c
Hi,
On Thursday, April 28, 2016 at 11:59:22 PM UTC+2, Rich Rauenzahn wrote:
>
> This is apparently an expected (and standardized) thing in SQL that ('A',
> 'B', NULL) is unique to ('A', 'B', NULL) as NULL is never equal to another
> NULL.
>
Yes, though the standard goes even further: every comp
I just got bitten by this today, finding a duplicate row where I didn't
expect one. I haven't been able to find an existing Django bug.
It's a popular topic on stack overflow:
http://stackoverflow.com/questions/17510261/django-unique-together-constraint-failure
http://dba.stackexchange.com/que