Bug / Omission? Lack of Unique Constraints in Database
Posted: Wed Jul 29, 2009 9:08 am
I was getting the following error on my product display page: [[ConLib:Custom/SG_BuyProductDialog]] Item has already been added. Key in dictionary: 'Name' Key being added: 'Name'. It turns out I had added duplicate entries in ac_ProductTemplateFields when I was running a SQL script to update some product templates. For example, I found the following two records in ac_ProductTemplateFields:
For performance reasons, I could understand not having additional unique constraints on basket or order tables but a table like ac_producttemplatefields is really only used by admin and shouldn't cause any performance hit (other than database size). There are probably other tables that could have unique constraints applied.
- ProductTemplateFieldId, ProductId, InputFieldId, InputValue
- 216, 129, 154, sg
- 305, 129, 154, sg
For performance reasons, I could understand not having additional unique constraints on basket or order tables but a table like ac_producttemplatefields is really only used by admin and shouldn't cause any performance hit (other than database size). There are probably other tables that could have unique constraints applied.
- Am I correct that ac_ProductTemplateFields should not have duplicate entries as described above?
- Are there reasons why unique constraints should not be applied to various tables in the system?