Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Error 1884 - uniqueness of primary key is violated
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00214399
Message ID:
00214508
Vues:
22
>>What you see is happening because the definition of a primary key is to be just that 'primary', that is no other record to match the same key.
>>
>>The problem you have happens because you are using a meaningfull primary key. Now if you were using a system generated key that would increment by 1 for every record you would not encounter the problem, and your people could enter several times the same date.
>>
>>Now, there are times where you must stick to the table design. What I do in such cases is filter the primary key FOR ! DELETED(). Now in order to get Rushmore optimization you'll need an index o DELETED() (that's always the case, for just any table) and another index on your date with no filter on it. By doing so you'll get full optimization.
>>
>>José
>
>Thanks Jose. I have setted the primary key with !Deleted() in the filter already. But it seems that my problem is still there. Is it the reason that, I'm using buffering 5 to this child table, so, the record that I perform DELETE is not really marked deleted() (cuz TableUpdate is not yet perform)? So, when I add another new record with the same date as that just deleted record, error 1884 happens?
>
>Also, I don't understand on the Rushmore optimization. Do you mean that I should have 3 tags on the same field?
>1. Filter primary key for !Deleted()
>2. Regular tag on the same field in filter Deleted()
>3. Regular tag on the same field with no filter
>
>Thanks
>Rosanna Man

About Rushmore first:
1. OK
2. a new index on DELETED(), no filter here
3. OK

Make things easy, first, that is perform your test in interactive mode, one step at a time until you are sure everything is allright. The remaining problem migth be because you are mixing deletes and inserts into a single operation. By doing so you have no control on which operation comes first and there's a possibility of clash. Now if you delete (even several records), tableupdate(), insert() and tableupdate() again you should be fine. If you're not happy with this, then change your system to use a system generated key.

José
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform