Skip to content

Errors related to constraints #202

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tredoe opened this issue Dec 26, 2013 · 1 comment
Closed

Errors related to constraints #202

tredoe opened this issue Dec 26, 2013 · 1 comment

Comments

@tredoe
Copy link

tredoe commented Dec 26, 2013

Every driver implementing "database/sql/driver" returns different messages when there are errors related to the integrity of constraints so they can not be handled easily.

So I did a proposal to add a type of error in the package "database/sql/driver" so it should be implemented by every driver.

Here it is the message with the proposal:
https://groups.google.com/forum/#!topic/golang-nuts/ECKF7N3jvjw

@arnehormann
Copy link
Member

copied from my mailing list answer:

github.com/go-sql-driver/mysql returns what MySQL sends, there's no mapping involved.

How should this be changed?
The error code alone is insufficient to infer all information (which index, which field, which table, ...).
Parsing the error string is brittle because it may change a little between versions and there's a whole bunch of them and they are not documented AFAIK.
How should the error types providing all the useful information look?

As is, we provide http://godoc.org/github.com/go-sql-driver/mysql#MySQLError
Everything else can easily be handled by a support library that does this stuff, but I personally wouldn't want the maintenance burden in the driver.

@arnehormann arnehormann mentioned this issue Jan 27, 2014
@julienschmidt julienschmidt added this to the sequel milestone May 16, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants