There's a standardized set of SQLSTATE codes for SQL
systems. Postgres and IBM DB2 use them directly.
That's what the Go SQL interface should be returning
on an error. MySQL has different codes, but there's a translation
table at
http://dev.mysql.com/doc/refman/5.7/en/connector-j-reference-error-sqlstates.html
SQLite also has its own set of codes, and those too
should be translated.
The "error" type returned by SQL packages should have
a Sqlstate() function to return the system-independent error
code, and perhaps a function to return the system-dependent
error code. Losing that information is unacceptable for
any serious database work.
John Nagle