Unique constraint violation error is incorrectly handled by Pg driver
Easy to fix, PR will follow in a minute. In brief:
-
messagewas used instead ofmessage-detail - the error text doesn't contain DETAIL: substring
- when regex match fails
$0containsNiland it causesmoarto panic.
Could you confirm, please?
Sorry, same problem! Will try to get back to this next week.
Not sure if I can thoroughly test this issue. I have fixed own code to prevent record duplication. And still don't have time to put together a test script. Or, rather, when I have time there're no more unburnt brains left to do the job... ;) Sorry for that. Considering how simple the problem was, I don't think any additional testing would be needed.
Ok, I quickly found how to break my code to get the duplications. Thanks to an ugly lock I haven't got time to get rid of! Now the error is weirdly flapping: sometimes I get valid 'unique constraint violated', sometime it is:
Died because of the exception:
No such method 'name' for invocant of type 'Any'. Did you mean any of these?
none
note
take
in method create-comment-to-caller at /Users/vrurg/src/Perl6/Red/lib/Red/ResultSeq.pm6 (Red::ResultSeq) line 42
in method head at /Users/vrurg/src/Perl6/Red/lib/Red/ResultSeq.pm6 (Red::ResultSeq) line 281
in method find at /Users/vrurg/src/Perl6/Red/lib/MetamodelX/Red/Model.pm6 (MetamodelX::Red::Model) line 364
in block at /Users/vrurg/src/Perl6/Red/lib/MetamodelX/Red/Model.pm6 (MetamodelX::Red::Model) line 316
in block at /Users/vrurg/src/Perl6/Red/lib/MetamodelX/Red/Model.pm6 (MetamodelX::Red::Model) line 312
Note that this happens in a highly concurrent environment where almost everything parallelized.
I think this is better be closed too. If anything like this would ever happen again it deserves another issue with better golfing down to some sample code.