Red icon indicating copy to clipboard operation
Red copied to clipboard

Unique constraint violation error is incorrectly handled by Pg driver

Open vrurg opened this issue 6 years ago • 5 comments

Easy to fix, PR will follow in a minute. In brief:

  • message was used instead of message-detail
  • the error text doesn't contain DETAIL: substring
  • when regex match fails $0 contains Nil and it causes moar to panic.

vrurg avatar Jun 13 '19 19:06 vrurg

Could you confirm, please?

FCO avatar Jun 28 '19 23:06 FCO

Sorry, same problem! Will try to get back to this next week.

vrurg avatar Jun 28 '19 23:06 vrurg

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.

vrurg avatar Jul 22 '19 02:07 vrurg

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.

vrurg avatar Jul 22 '19 02:07 vrurg

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.

vrurg avatar Sep 12 '21 21:09 vrurg