# Dokumentenerstellung Fehler SQLSTATE\[23000\]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY'

**URL:** <https://forum.shopware.com/t/dokumentenerstellung-fehler-sqlstate-23000-integrity-constraint-violation-1062-duplicate-entry-0-for-key-primary/99893>\
**Category:** Shopware 5\
**Created:** [30. Mai 2023 um 15:13 UTC](https://forum.shopware.com/t/dokumentenerstellung-fehler-sqlstate-23000-integrity-constraint-violation-1062-duplicate-entry-0-for-key-primary/99893 "2023-05-30T15:13:06Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![kattina](https://avatars.discourse-cdn.com/v4/letter/k/ba8739/32.png) [@kattina](https://forum.shopware.com/u/kattina)\
**Post date:** [30. Mai 2023 um 15:13 UTC](https://forum.shopware.com/t/dokumentenerstellung-fehler-sqlstate-23000-integrity-constraint-violation-1062-duplicate-entry-0-for-key-primary/99893/1 "2023-05-30T15:13:06Z")

</div>

Hallo liebe Community,

beim Versuch, eine Rechnung zu erstellen, ist es zu folgender Fehlermeldung gekommen:

Beim Speichern des Dokuments ist ein Fehler aufgetreten.  
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‚0‘ for key ‚PRIMARY‘

Diese tritt auch bei den anderen Dokumententypen auf. Ich nutze Shopware 5.7.17, aktuell noch mit PHP 7.4.33.  
Weiß jemand, wie ich den Fehler lösen kann?

Vielen Dank,  
Katharina

---

<div class="post-metadata">

**Author:** ![MBDealer](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/mbdealer/32/27217_2.png) [@MBDealer](https://forum.shopware.com/u/MBDealer)\
**Post date:** [30. Mai 2023 um 15:17 UTC](https://forum.shopware.com/t/dokumentenerstellung-fehler-sqlstate-23000-integrity-constraint-violation-1062-duplicate-entry-0-for-key-primary/99893/2 "2023-05-30T15:17:19Z")

</div>

Schau mal hier, vielleicht hilft dir dieser Punkt weiter: [Shopware 5 - Tutorials & FAQs - Fehlermeldungen in Shopware debuggen](https://docs.shopware.com/de/shopware-5-de/tutorials-und-faq/fehlermeldungen-in-shopware-debuggen#integrity-constraint-violation)

---

<div class="post-metadata">

**Author:** ![kattina](https://avatars.discourse-cdn.com/v4/letter/k/ba8739/32.png) [@kattina](https://forum.shopware.com/u/kattina)\
**Post date:** [31. Mai 2023 um 16:08 UTC](https://forum.shopware.com/t/dokumentenerstellung-fehler-sqlstate-23000-integrity-constraint-violation-1062-duplicate-entry-0-for-key-primary/99893/3 "2023-05-31T16:08:04Z")

</div>

Vielen Dank für die Antwort! Der Fehler ist leider noch da, im System Log ist er folgendermaßen, vielleicht kann man da die Ursache erkennen?

PDOException: SQLSTATE(23000): Integrity constraint violation: 1062 Duplicate entry ‚0‘ for key ‚PRIMARY‘ in /vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:117 Stack trace:  
#0 /vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php(117): PDOStatement-\>execute()  
#1 /engine/Library/Zend/Db/Statement/Pdo.php(219): Doctrine\DBAL\Driver\PDOStatement-\>execute()  
#2 /engine/Library/Zend/Db/Statement.php(297): Zend\_Db\_Statement\_Pdo-\>\_execute()  
#3 /engine/Library/Zend/Db/Adapter/Abstract.php(472): Zend\_Db\_Statement-\>execute()  
#4 /engine/Library/Zend/Db/Adapter/Pdo/Abstract.php(232): Zend\_Db\_Adapter\_Abstract-\>query()  
#5 /engine/Library/Enlight/Components/Db/Adapter/Pdo/Mysql.php(82): Zend\_Db\_Adapter\_Pdo\_Abstract-\>query()  
#6 /engine/Shopware/Components/Document.php(773): Enlight\_Components\_Db\_Adapter\_Pdo\_Mysql-\>query()  
#7 /var/www/vhosts/xxx.frida.hostkraft.de/html/shopware/var/cache/production\_202303281109/proxies/ShopwareComponentsDocumentProxy.php(78): Shopware\_Components\_Document-\>saveDocument()  
#8 /engine/Library/Enlight/Hook/HookExecutionContext.php(131): Shopware\_Proxies\_ShopwareComponentsDocumentProxy-\>\_\_executeOriginalMethod()  
#9 /engine/Library/Enlight/Hook/HookExecutionContext.php(100): Enlight\_Hook\_HookExecutionContext-\>executeReplaceChain()  
#10 /engine/Library/Enlight/Hook/HookManager.php(172): Enlight\_Hook\_HookExecutionContext-\>execute()  
#11 /var/www/vhosts/xxx.frida.hostkraft.de/html/shopware/var/cache/production\_202303281109/proxies/ShopwareComponentsDocumentProxy.php(101): Enlight\_Hook\_HookManager-\>executeHooks()  
#12 /engine/Shopware/Components/Document.php(347): Shopware\_Proxies\_ShopwareComponentsDocumentProxy-\>saveDocument()  
#13 /var/www/vhosts/xxx.frida.hostkraft.de/html/shopware/var/cache/production\_202303281109/proxies/ShopwareComponentsDocumentProxy.php(78): Shopware\_Components\_Document-\>assignValues()  
#14 /engine/Library/Enlight/Hook/HookExecutionContext.php(131): Shopware\_Proxies\_ShopwareComponentsDocumentProxy-\>\_\_executeOriginalMethod()  
#15 /engine/Library/Enlight/Hook/HookExecutionContext.php(100): Enlight\_Hook\_HookExecutionContext-\>executeReplaceChain()  
#16 /engine/Library/Enlight/Hook/HookManager.php(172): Enlight\_Hook\_HookExecutionContext-\>execute()  
#17 /var/www/vhosts/xxx.frida.hostkraft.de/html/shopware/var/cache/production\_202303281109/proxies/ShopwareComponentsDocumentProxy.php(89): Enlight\_Hook\_HookManager-\>executeHooks()  
#18 /engine/Shopware/Components/Document.php(273): Shopware\_Proxies\_ShopwareComponentsDocumentProxy-\>assignValues()  
#19 /engine/Shopware/Controllers/Backend/Order.php(1927): Shopware\_Components\_Document-\>render()  
#20 /engine/Shopware/Controllers/Backend/Order.php(1226): Shopware\_Controllers\_Backend\_Order-\>createDocument()  
#21 /engine/Library/Enlight/Controller/Action.php(187): Shopware\_Controllers\_Backend\_Order-\>createDocumentAction()  
#22 /engine/Library/Enlight/Controller/Dispatcher/Default.php(467): Enlight\_Controller\_Action-\>dispatch()  
#23 /engine/Library/Enlight/Controller/Front.php(226): Enlight\_Controller\_Dispatcher\_Default-\>dispatch()  
#24 /engine/Shopware/Kernel.php(197): Enlight\_Controller\_Front-\>dispatch()  
#25 /vendor/symfony/http-kernel/HttpCache/SubRequestHandler.php(85): Shopware\Kernel-\>handle()  
#26 /vendor/symfony/http-kernel/HttpCache/HttpCache.php(479): Symfony\Component\HttpKernel\HttpCache\SubRequestHandler::handle()  
#27 /engine/Shopware/Components/HttpCache/AppCache.php(270): Symfony\Component\HttpKernel\HttpCache\HttpCache-\>forward()  
#28 /vendor/symfony/http-kernel/HttpCache/HttpCache.php(269): Shopware\Components\HttpCache\AppCache-\>forward()  
#29 /engine/Shopware/Components/HttpCache/AppCache.php(106): Symfony\Component\HttpKernel\HttpCache\HttpCache-\>pass()  
#30 /var/www/vhosts/xxx.frida.hostkraft.de/html/shopware/shopware.php(122): Shopware\Components\HttpCache\AppCache-\>handle()  
#31

---

<div class="post-metadata">

**Author:** ![R4M](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/r4m/32/9983_2.png) [@R4M](https://forum.shopware.com/u/R4M)\
**Post date:** [6. Juni 2023 um 10:17 UTC](https://forum.shopware.com/t/dokumentenerstellung-fehler-sqlstate-23000-integrity-constraint-violation-1062-duplicate-entry-0-for-key-primary/99893/5 "2023-06-06T10:17:31Z")

</div>

Was sagt denn die Fehlermeldung vom Server?

---

<div class="post-metadata">

**Author:** ![kattina](https://avatars.discourse-cdn.com/v4/letter/k/ba8739/32.png) [@kattina](https://forum.shopware.com/u/kattina)\
**Post date:** [6. Juni 2023 um 11:27 UTC](https://forum.shopware.com/t/dokumentenerstellung-fehler-sqlstate-23000-integrity-constraint-violation-1062-duplicate-entry-0-for-key-primary/99893/6 "2023-06-06T11:27:35Z")

</div>

Meinst du die in der Logfile?

SQLSTATE(23000): Integrity constraint violation: 1062 Duplicate entry ‚0‘ for key ‚PRIMARY‘ in /var/www/vhosts/xxx.frida.hostkraft.de/html/shopware/engine/Library/Zend/Db/Statement/Pdo.php:224 Stack trace: #0 /var/www/vhosts/xxx.frida.hostkraft.de/html/shopware/engine/Library/Zend/Db/Statement.php(297): Zend\_Db\_Statement\_Pdo-\>\_execute() #1 /var/www/vhosts/xxx.frida.hostkraft.de/html/shopware/engine/Library/Zend/Db/Adapter/Abstract.php(472): Zend\_Db\_Statement-\>execute() #2 /var/www/vhosts/xxx.frida.hostkraft.de/html/shopware/engine/Library/Zend/Db/Adapter/Pdo/Abstract.php(232): Zend\_Db\_Adapter\_Abstract-\>query() #3 /var/www/vhosts/xxx.frida.hostkraft.de/html/shopware/engine/Library/Enlight/Components/Db/Adapter/Pdo/Mysql.php(82): Zend\_Db\_Adapter\_Pdo\_Abstract-\>query() #4 /var/www/vhosts/xxx.frida.hostkraft.de/html/shopware/engine/Shopware/Components/Document.php(773): Enlight\_Components\_Db\_Adapter\_Pdo\_Mysql-\>query() #5 /var/www/vhosts/xxx.frida.hostkraft.de/html/shopware/var/cache/production\_202303281109/proxies/ShopwareComponentsDocumentProxy.php(78): Shopware\_Components\_Document-\>saveDocument() #6 /var/www/vhosts/xxx.frida.hostkraft.de/html/shopware/engine/Library/Enlight/Hook/HookExecutionContext.php(131): Shopware\_Proxies\_ShopwareComponentsDocumentProxy-\>\_\_executeOriginalMethod() #7 /var/www/vhosts/xxx.frida.hostkraft.de/html/shopware/engine/Library/Enlight/Hook/HookExecutionContext.php(100): Enlight\_Hook\_HookExecutionContext-\>executeReplaceChain() #8 /var/www/vhosts/xxx.frida.hostkraft.de/html/shopware/engine/Library/Enlight/Hook/HookManager.php(172): Enlight\_Hook\_HookExecutionContext-\>execute() #9 /var/www/vhosts/xxx.frida.hostkraft.de/html/shopware/var/cache/production\_202303281109/proxies/ShopwareComponentsDocumentProxy.php(101): Enlight\_Hook\_HookManager-\>executeHooks() #10 /var/www/vhosts/xxx.frida.hostkraft.de/html/shopware/engine/Shopware/Components/Document.php(347): Shopware\_Proxies\_ShopwareComponentsDocumentProxy-\>saveDocument() #11 /var/www/vhosts/xxx.frida.hostkraft.de/html/shopware/var/cache/production\_202303281109/proxies/ShopwareComponentsDocumentProxy.php(78): Shopware\_Components\_Document-\>assignValues() #12 /var/www/vhosts/xxx.frida.hostkraft.de/html/shopware/engine/Library/Enlight/Hook/HookExecutionContext.php(131): Shopware\_Proxies\_ShopwareComponentsDocumentProxy-\>\_\_executeOriginalMethod() #13 /var/www/vhosts/xxx.frida.hostkraft.de/html/shopware/engine/Library/Enlight/Hook/HookExecutionContext.php(100): Enlight\_Hook\_HookExecutionContext-\>executeReplaceChain() #14 /var/www/vhosts/xxx.frida.hostkraft.de/html/shopware/engine/Library/Enlight/Hook/HookManager.php(172): Enlight\_Hook\_HookExecutionContext-\>execute() #15 /var/www/vhosts/xxx.frida.hostkraft.de/html/shopware/var/cache/production\_202303281109/proxies/ShopwareComponentsDocumentProxy.php(89): Enlight\_Hook\_HookManager-\>executeHooks() #16 /var/www/vhosts/xxx.frida.hostkraft.de/html/shopware/engine/Shopware/Components/Document.php(273): Shopware\_Proxies\_ShopwareComponentsDocumentProxy-\>assignValues() #17 /var/www/vhosts/xxx.frida.hostkraft.de/html/shopware/engine/Shopware/Controllers/Backend/Order.php(1927): Shopware\_Components\_Document-\>render() #18 /var/www/vhosts/xxx.frida.hostkraft.de/html/shopware/engine/Shopware/Controllers/Backend/Order.php(1226): Shopware\_Controllers\_Backend\_Order-\>createDocument() #19 /var/www/vhosts/xxx.frida.hostkraft.de/html/shopware/engine/Library/Enlight/Controller/Action.php(187): Shopware\_Controllers\_Backend\_Order-\>createDocumentAction() #20 /var/www/vhosts/xxx.frida.hostkraft.de/html/shopware/engine/Library/Enlight/Controller/Dispatcher/Default.php(467): Enlight\_Controller\_Action-\>dispatch() #21 /var/www/vhosts/xxx.frida.hostkraft.de/html/shopware/engine/Library/Enlight/Controller/Front.php(226): Enlight\_Controller\_Dispatcher\_Default-\>dispatch() #22 /var/www/vhosts/xxx.frida.hostkraft.de/html/shopware/engine/Shopware/Kernel.php(197): Enlight\_Controller\_Front-\>dispatch() #23 /var/www/vhosts/xxx.frida.hostkraft.de/html/shopware/vendor/symfony/http-kernel/HttpCache/SubRequestHandler.php(85): Shopware\Kernel-\>handle() #24 /var/www/vhosts/xxx.frida.hostkraft.de/html/shopware/vendor/symfony/http-kernel/HttpCache/HttpCache.php(479): Symfony\Component\HttpKernel\HttpCache\SubRequestHandler::handle() #25 /var/www/vhosts/xxx.frida.hostkraft.de/html/shopware/engine/Shopware/Components/HttpCache/AppCache.php(270): Symfony\Component\HttpKernel\HttpCache\HttpCache-\>forward() #26 /var/www/vhosts/xxx.frida.hostkraft.de/html/shopware/vendor/symfony/http-kernel/HttpCache/HttpCache.php(269): Shopware\Components\HttpCache\AppCache-\>forward() #27 /var/www/vhosts/xxx.frida.hostkraft.de/html/shopware/engine/Shopware/Components/HttpCache/AppCache.php(106): Symfony\Component\HttpKernel\HttpCache\HttpCache-\>pass() #28 /var/www/vhosts/xxx.frida.hostkraft.de/html/shopware/shopware.php(122): Shopware\Components\HttpCache\AppCache-\>handle() #29 {main} {„uid“:„589397b“}

---

<div class="post-metadata">

**Author:** ![R4M](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/r4m/32/9983_2.png) [@R4M](https://forum.shopware.com/u/R4M)\
**Post date:** [6. Juni 2023 um 11:30 UTC](https://forum.shopware.com/t/dokumentenerstellung-fehler-sqlstate-23000-integrity-constraint-violation-1062-duplicate-entry-0-for-key-primary/99893/7 "2023-06-06T11:30:07Z")

</div>

Es gibt ein Shopware-Log (dein Text) und es gibt ein Server-Log (error\_log) welches meist außerhalb von deinem Root-Verzeichnis liegt. Eventuell dazu auch mal beim Hoster nachfragen. Ich meine Server-Log, ob dort ggf. noch Fehler aufgezeigt werden.

---

<div class="post-metadata">

**Author:** ![kattina](https://avatars.discourse-cdn.com/v4/letter/k/ba8739/32.png) [@kattina](https://forum.shopware.com/u/kattina)\
**Post date:** [6. Juni 2023 um 11:33 UTC](https://forum.shopware.com/t/dokumentenerstellung-fehler-sqlstate-23000-integrity-constraint-violation-1062-duplicate-entry-0-for-key-primary/99893/8 "2023-06-06T11:33:36Z")

</div>

Vielen Dank!  
In der error\_log steht:  
[ssl:warn] [pid 15093] AH01909: RSA certificate configured for [xxx.frida.hostkraft.de:443](http://xxx.frida.hostkraft.de:443) does NOT include an ID which matches the server name

---

<div class="post-metadata">

**Author:** ![R4M](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/r4m/32/9983_2.png) [@R4M](https://forum.shopware.com/u/R4M)\
**Post date:** [6. Juni 2023 um 11:57 UTC](https://forum.shopware.com/t/dokumentenerstellung-fehler-sqlstate-23000-integrity-constraint-violation-1062-duplicate-entry-0-for-key-primary/99893/9 "2023-06-06T11:57:48Z")

</div>

Du müsstest ggf, die Uhrzeiten abgleichen, damit die Meldungen auch zusammen passen, also falls vorhanden.

---

<div class="post-metadata">

**Author:** ![kattina](https://avatars.discourse-cdn.com/v4/letter/k/ba8739/32.png) [@kattina](https://forum.shopware.com/u/kattina)\
**Post date:** [6. Juni 2023 um 14:35 UTC](https://forum.shopware.com/t/dokumentenerstellung-fehler-sqlstate-23000-integrity-constraint-violation-1062-duplicate-entry-0-for-key-primary/99893/10 "2023-06-06T14:35:49Z")

</div>

Die Uhrzeiten passen nicht zusammen, im Shopware log ist es 11:33 Uhr, im Server Log dagegen 09:36. Passt also nicht zusammen… 🤔

---

<div class="post-metadata">

**Author:** ![R4M](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/r4m/32/9983_2.png) [@R4M](https://forum.shopware.com/u/R4M)\
**Post date:** [7. Juni 2023 um 06:13 UTC](https://forum.shopware.com/t/dokumentenerstellung-fehler-sqlstate-23000-integrity-constraint-violation-1062-duplicate-entry-0-for-key-primary/99893/11 "2023-06-07T06:13:35Z")

</div>

Du solltest schauen, welche Fehlermeldungen nachdem Zeitstemphel zusammen passen.

Seit wann ist übrigens der Fehler? Lässt sich das eingrenzen? Wurde in diesem Zeitraum ein Shopware Update gemacht oder ein Plugin installiert oder aktualisiert?

---

<div class="post-metadata">

**Author:** ![kattina](https://avatars.discourse-cdn.com/v4/letter/k/ba8739/32.png) [@kattina](https://forum.shopware.com/u/kattina)\
**Post date:** [7. Juni 2023 um 09:20 UTC](https://forum.shopware.com/t/dokumentenerstellung-fehler-sqlstate-23000-integrity-constraint-violation-1062-duplicate-entry-0-for-key-primary/99893/12 "2023-06-07T09:20:03Z")

</div>

Ich habe im error\_log sonst keine weiteren Fehlermeldungen.  
Der Fehler ist vermutlich nach dem Update auf 5.7 aufgetreten, in dem Rahmen habe ich zudem das PayPal Plugin aktualisiert.  
Ich vermute, dass es an einer fehlerhaften Tabelle in der Datenbank liegt, finde sie bisher jedoch nicht… Die Foreign Key Reparatur hat ja leider ebenfalls nicht die Lösung erbracht.

---

<div class="post-metadata">

**Author:** ![R4M](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/r4m/32/9983_2.png) [@R4M](https://forum.shopware.com/u/R4M)\
**Post date:** [8. Juni 2023 um 09:12 UTC](https://forum.shopware.com/t/dokumentenerstellung-fehler-sqlstate-23000-integrity-constraint-violation-1062-duplicate-entry-0-for-key-primary/99893/13 "2023-06-08T09:12:43Z")

</div>

> [@kattina](#):
>
> fehlerhaften Tabelle

Eher ein fehlerhafter Eintrag in einer Tabelle. Konnte aber bisher das auch nich nicht näher analysieren.

> [@kattina](#):
>
> Duplicate entry ‚0‘ for key

Irgendwo scheint ein Eintrag mit „0“ enthalten zu sein, welcher aber nur einmal in der Tabelle stehen darf. Ich weiß leider bisher auch (noch) nicht welche Tabelle das sein kann.

---

<div class="post-metadata">

**Author:** ![kattina](https://avatars.discourse-cdn.com/v4/letter/k/ba8739/32.png) [@kattina](https://forum.shopware.com/u/kattina)\
**Post date:** [11. Juni 2023 um 12:04 UTC](https://forum.shopware.com/t/dokumentenerstellung-fehler-sqlstate-23000-integrity-constraint-violation-1062-duplicate-entry-0-for-key-primary/99893/14 "2023-06-11T12:04:46Z")

</div>

Ich vermute, dass das Problem ist, dass entweder 2 Primary Keys in einer Tabelle vergeben wurden, oder eben gar keiner. Habe in der Tabelle s\_mail\_log\_document zumnindest gesehen, dass hier 2 Primary Keys definiert sind, und frage mich, ob das so richtig ist oder ob das evtl zu dem Fehler führt. Wenn ich jedoch nur einen der beiden als Primary Key auswähle, besteht der Fehler leider fort. Außerdem ist Auto Increment nicht aktiviert, beim Versuch es zu aktivieren kommt jedoch leider eine Fehlermeldung (#1832 - Cannot change column ‚log\_id‘: used in a foreign key constraint ‚s\_mail\_log\_document\_ibfk\_2‘)…

 ![Bildschirmfoto 2023-06-11 um 14.02.24](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/3X/e/3/e37ef52a69d991e68ae2bbf05e8696170af5202c.jpeg)

---

<div class="post-metadata">

**Author:** ![R4M](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/r4m/32/9983_2.png) [@R4M](https://forum.shopware.com/u/R4M)\
**Post date:** [12. Juni 2023 um 07:06 UTC](https://forum.shopware.com/t/dokumentenerstellung-fehler-sqlstate-23000-integrity-constraint-violation-1062-duplicate-entry-0-for-key-primary/99893/15 "2023-06-12T07:06:07Z")

</div>

> [@kattina](#):
>
> Außerdem ist Auto Increment nicht aktiviert,

Was die Tabelle „s\_mail\_log\_document“ betrifft, so darf das hier auch nicht sein.

---

<div class="post-metadata">

**Author:** ![kattina](https://avatars.discourse-cdn.com/v4/letter/k/ba8739/32.png) [@kattina](https://forum.shopware.com/u/kattina)\
**Post date:** [18. Juni 2023 um 08:06 UTC](https://forum.shopware.com/t/dokumentenerstellung-fehler-sqlstate-23000-integrity-constraint-violation-1062-duplicate-entry-0-for-key-primary/99893/16 "2023-06-18T08:06:07Z")

</div>

Hm… Ich frage mich, wie ich die fehlerhafte Tabelle finden kann…

---

<div class="post-metadata">

**Author:** ![kattina](https://avatars.discourse-cdn.com/v4/letter/k/ba8739/32.png) [@kattina](https://forum.shopware.com/u/kattina)\
**Post date:** [18. Juni 2023 um 11:52 UTC](https://forum.shopware.com/t/dokumentenerstellung-fehler-sqlstate-23000-integrity-constraint-violation-1062-duplicate-entry-0-for-key-primary/99893/17 "2023-06-18T11:52:05Z")

</div>

Habe die Lösung gefunden: Das Problem lag in der \_order\_documents, hier war für id ein Eintrag mit ‚0‘ vergeben, was den Fehler ausgelöst hat. Das Löschen des Eintrages hat nun die Lösung gebracht. Vielen Dank für die Unterstützung!

Edit: Nun folgt das nächste Problem 😅 Sobald ich ein neues Dokument erstelle, wird wieder ein Eintrag mit der id ‚0‘ erstellt. Gibt es eine Möglichkeit, das zu unterbinden? Sonst müsste ich jedes mal manuell den DB Eintrag löschen.

---

<div class="post-metadata">

**Author:** ![drakon](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/drakon/32/7724_2.png) [@drakon](https://forum.shopware.com/u/drakon)\
**Post date:** [18. Juni 2023 um 12:39 UTC](https://forum.shopware.com/t/dokumentenerstellung-fehler-sqlstate-23000-integrity-constraint-violation-1062-duplicate-entry-0-for-key-primary/99893/18 "2023-06-18T12:39:20Z")

</div>

Für die ID in dieser Tabelle sollte auto\_increment aktiv sein, dann dürfte das eigentlich nicht passieren.

---

<div class="post-metadata">

**Author:** ![kattina](https://avatars.discourse-cdn.com/v4/letter/k/ba8739/32.png) [@kattina](https://forum.shopware.com/u/kattina)\
**Post date:** [18. Juni 2023 um 12:51 UTC](https://forum.shopware.com/t/dokumentenerstellung-fehler-sqlstate-23000-integrity-constraint-violation-1062-duplicate-entry-0-for-key-primary/99893/19 "2023-06-18T12:51:20Z")

</div>

Genau, das dachte ich auch. Jedoch ist auto\_increment nicht aktiviert, beim Versuch es zu aktivieren erhalte ich folgende Fehlermeldung:  
#1833 - Cannot change column ‚id‘: used in a foreign key constraint ‚s\_mail\_log\_document\_ibfk\_1‘ of table ‚xxx\_sw.s\_mail\_log\_document‘  
Hab leider nicht so tiefreichende Kenntnisse um diesen Fehler auf dem Stegreif zu umgehen…
