Closed glamorous closed 14 years ago
The unique validation callback introduces a lot of overhead though, because it must query the database to see if the primary key already exists. Generally the uniqueness of primary keys is managed by the database auto-incrementing on INSERT.
If your primary keys are strings or something that the database can't auto-increment, then setting unique to TRUE makes sense. However, since this is not the norm, FALSE is what the default is.
Ok thanks, that's a good explanation. I didn't knew that this was used to do some extra query-work. :)
Don't know if it's necessary for the code but a primary key should always be unique. Now it's default set to FALSE what's incorrect.