Closed (fixed)
Project:
Drupal core
Version:
9.1.x-dev
Component:
mysql db driver
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
14 Sep 2018 at 07:33 UTC
Updated:
21 Aug 2020 at 14:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
mondrakeHere's a test only patch that should proof the issue across different drivers.
Comment #4
mondrakeSo looking at how this is managed in
handleQueryException, this is only applicable when an insert does not define a column and the table column has no default set.Adjusted issue summary and title.
Let's see if this works.
Comment #6
mondrakeSorry wrong patch in #4, interdiff is OK.
Comment #8
mondrakeMySql error code is in errorInfo[1].
Comment #10
mondrakeIn PHP 7, \RuntimeException that IntegrityConstraintViolationException extends from has a strict typehint on $code being a long. Here the PDOException would store 'HY000', which fails the signature. Converting to 0 in this case.
Comment #11
mondrakeLooking at the failures in #8, with this we can actually make
EntityDefinitionUpdateTest::testBundleFieldCreateDeleteWithExistingEntitiesstronger!Comment #15
daffie commentedComment #16
daffie commentedThese lines can be removed. They are only doing the default thing.
Why are we doing an is_int() test? Every where else in core we just use the
$e->getCode()value.The patch also needs a reroll.
Comment #17
mrinalini9 commentedRerolled patch for 9.1.x and also done changes as mentioned in #16, please review.
Comment #19
hardik_patel_12 commentedKindly review a new patch.
Comment #20
daffie commentedPatch looks good. I got just one remark:
This line can also be removed.
Also my question from comment #16.2 is still open.
Comment #21
mondrake@daffie re. #16.2 see #10.
Comment #22
ravi.shankar commentedHere I have made changes as per comment #20.
Comment #23
hardik_patel_12 commented@daffie and @ravi.shankar , in #19 i have intentionally skipped the 16.2, as here the PDOException would store 'HY000', which fails the signature() which is mentioned mentioned by @mondrake.
Comment #24
daffie commentedAll my points are addressed.
All code changes look good to me.
For me it is RTBC.
Comment #25
catchPatch looks reasonable to me, but needs a reroll.
Comment #26
vsujeetkumar commentedRe-roll patch created, Please review.
Comment #28
mr.baileysNitpick, and haven't looked at the patch in full, but the correct capitalization is "MySQL".
Comment #29
vsujeetkumar commentedFixed test, Please review.
Comment #30
mondrakeRerolled from #22.
EDIT - xpost with #28 and #29
Comment #32
daffie commentedBack to RTBC.
Comment #34
catchFixed this on commit.
Committed bacf782 and pushed to 9.1.x. Thanks!
I just realised after commit, that
IntegrityConstraintViolationExceptiondoesn't extend DatabaseExceptionWrapper - so if someone was catching DatabaseExceptionWrapper specifically for this case, it might fail. This seems extremely unlikely, so I don't think it even needs a change record, but noting here in case anyone wants to do one just in case. I do think it's a reason to make this issue 9.1.x only though.Comment #35
mondrakeAdded and published CR, https://www.drupal.org/node/3164002