Subject RE: [firebird-support] RE: [Firebird-net-provider] conversion error from string " "
Author Alan McDonald
> :: This was it:
> :: CREATE UNIQUE INDEX "IDX_Cart_1" ON "Cart"("InvoiceNo");
> ::
> :: When trying to insert new rows and InvoiceNo was null, it
> :: did this. Null is not a value - so why would this be a problem?
>
> More info. This index was applied with many rows already having null. Ok -
> but as soon as I applied this index, I could not insert rows any more with
> null in that field. As soon as I deactivated or deleted the index - I can
> insert just fine again.
>
> Happens on both production and test DBs.

This is the same behaviour as when you change a domain so it has a default
value. The column may contain nulls. Good admin tools realise this and ask
if you want to update the field. Likewise it's up to you before creating a
unique index to check for duplicates. It's not just the presence of null
values it's duplicates of any kind.
I've never considered this a bug - just an administrative task to carry out
when you are (re)designing your database.
select mynewunique, count(*) from mytable group by mynewunique
will show you straight away if what you are proposing is sensible given the
current state of that table.
Alan