Re: Uncaught PHP Exception Doctrine\DBAL\Exception\UniqueConstraintViolationException: "An exception occurred while executing 'UPDATE

From: Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com>
To: Jarosław Torbicki <jaroslaw(dot)torbicki(at)symmetry(dot)pl>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Uncaught PHP Exception Doctrine\DBAL\Exception\UniqueConstraintViolationException: "An exception occurred while executing 'UPDATE
Date: 2018-08-14 11:11:03
Message-ID: 94db111f-4c77-7bbb-da32-f76e51f32ba5@2ndQuadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 08/14/2018 05:58 AM, Jarosław Torbicki wrote:
>
> Hello,
>
> I used PostgreSQL 9.3 but I executed upgrade few days ago.
>
> Now, I am using 10.4 PostgreSQL and:
>
> doctrine/annotations                 v1.2.7
>
> doctrine/cache                       v1.4.2
>
> doctrine/collections                 v1.3.0
>
> doctrine/common                      v2.7.3
>
> doctrine/dbal                        v2.5.13
>
> doctrine/doctrine-bundle             v1.5.2
>
> doctrine/doctrine-cache-bundle       v1.0.1
>
> doctrine/inflector                   v1.0.1
>
> doctrine/instantiator                1.0.5
>
> doctrine/lexer                       v1.0.1
>
> doctrine/orm                         v2.5.14
>
> I have a problem with ManyToOne relation.
>
> For example, I have main object with three child and when I execute on
> main object
>
>                             $em = $this->getDoctrine()->getManager();
>
>                 $em->merge($data);
>
>                             $em->flush();
>
> I sometimes get ERROR message like:
>
> /Uncaught PHP Exception
> Doctrine\DBAL\Exception\UniqueConstraintViolationException: "An
> exception occurred while executing 'UPDATE/
>
> I get this ERRROR message not for all main object and not for all
> child. For example, first update child object is ok but in second I
> get error.
>
> SQL prepared by doctrine:
>
> UPDATE child_table SET id = ?, name = ?, object_name = ?, object_size
> = ? WHERE id = ?' with params ["2", "test Name object 2", "test name
> object 2", "1234", 3]
>
> In this sql the doctrine tries update object with id=3 using data from
> object with id = 2.
>
> This problem didn’t occur before executing upgrade to 10.4 version.
>
> Can you help me and give some tips?
>

This mailing list is about development of PostgreSQL, not about how to
use it. Please ask in the correct forum (possibly the pgsql-general
mailing list)

cheers

andrew

--
Andrew Dunstan https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Gierth 2018-08-14 11:37:16 Re: [HACKERS] pgbench - allow to store select results into variables
Previous Message Andrew Dunstan 2018-08-14 10:47:43 Re: [HACKERS] pgbench - allow to store select results into variables