Doctrine + Postgres duplicate records on insert #11029
Unanswered
JPradaa
asked this question in
Support Questions
Replies: 1 comment
-
I had the same problem and when i deactivated turbo (Symfony UX Turbo Core) it worked fine. due to turbo the redirects happened twice because first time it happened at an ajax page reload caused by turbo and due to the redirect it happened again. if you use turbo try to deactivate it completely or only on certain links with the data-turbo="false" attribute. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello everyone
I'm starting a project with Symfony 6.3 and Postgres 14
When I create a new entity and save it in the DB using "persist" and "flush" 2 identical records are created in the DB
Controller
Entity
Using MySQL the same code inserts a single record, but with Postgres 2 records are inserted
The biggest difference I see is that Doctrine, in the case of Postgres, performs a
SELECT NEXTVAL('live.client_id_seq')
to get the next value in the sequence and generate an INSERT using that value, instead of leaving that task to the DB
INSERT INTO live.client (id, name, code) VALUES (25, 'Cliente name', 'CLIENT_CODE')
I have tried it on Windows and Linux, using different versions of Symfony 6.x, ... and in all cases I get the same result
If once the page is loaded (and 2 records created in the CLIENT table) I go to the profiler and later return to the page using the browser's "back" button, then only 1 record is inserted instead of 2
Does anyone know what could be happening and how to fix the problem?
Thank you very much for your help
All the best
Beta Was this translation helpful? Give feedback.
All reactions