diff --git a/errors.go b/errors.go index a088dcdd..7a21af98 100644 --- a/errors.go +++ b/errors.go @@ -55,6 +55,11 @@ func (pe *PgError) Error() string { return pe.Severity + ": " + pe.Message + " (SQLSTATE " + pe.Code + ")" } +// SQLState returns the SQLState of the error. +func (pe *PgError) SQLState() string { + return pe.Code +} + type connectError struct { config *Config msg string