Mysql2::Error: Duplicate entry for '%s' for key '%s' is not handled by UniqueConstraintViolation

2018-11-13 Thread Jeremy Evans
Sure, please submit as a PR. I won't be able to test and merge for a couple 
weeks, but it should make the next release.

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sequel-talk+unsubscr...@googlegroups.com.
To post to this group, send email to sequel-talk@googlegroups.com.
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.


Mysql2::Error: Duplicate entry for '%s' for key '%s' is not handled by UniqueConstraintViolation

2018-11-13 Thread Marcelo Pereira
Hello,

I have this error being raised:

```
Mysql2::Error: Duplicate entry '...' for key 
'index_users_on_userid_and_application_id': INSERT INTO `users` (`userid`, 
`application_id`, `created_at`, `updated_at`) VALUES (...)
```

and it doesn't get rescued with `rescue Sequel::UniqueConstraintViolation`. 
I've checked the list of error codes on MySQL documentation and in this 
case the code is 1586. Looking at 
_lib/sequel/adapters/utils/mysql_mysql2.rb_, on the 
`database_specific_error_class` method, I see that error code 1062 is 
mapped as unique constraint violation, but 1586 is not.

Is this on purpose? Should the method read `when 1062, 1586; 
UniqueConstraintViolation` instead?

Please let me know if I can go ahead and open a pull request with this 
change.

Best,
Marcelo

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sequel-talk+unsubscr...@googlegroups.com.
To post to this group, send email to sequel-talk@googlegroups.com.
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.