pgerror

package
v0.0.0-...-220c46c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package pgerror is a generated protocol buffer package.

It is generated from these files:

cockroach/pkg/sql/pgwire/pgerror/errors.proto

It has these top-level messages:

Error

Index

Constants

View Source
const (
	// Class 00 - Successful Completion
	CodeSuccessfulCompletionError = "00000"
	// Class 01 - Warning
	CodeWarningError                                 = "01000"
	CodeWarningDynamicResultSetsReturnedError        = "0100C"
	CodeWarningImplicitZeroBitPaddingError           = "01008"
	CodeWarningNullValueEliminatedInSetFunctionError = "01003"
	CodeWarningPrivilegeNotGrantedError              = "01007"
	CodeWarningPrivilegeNotRevokedError              = "01006"
	CodeWarningStringDataRightTruncationError        = "01004"
	CodeWarningDeprecatedFeatureError                = "01P01"
	// Class 02 - No Data (this is also a warning class per the SQL standard)
	CodeNoDataError                                = "02000"
	CodeNoAdditionalDynamicResultSetsReturnedError = "02001"
	// Class 03 - SQL Statement Not Yet Complete
	CodeSQLStatementNotYetCompleteError = "03000"
	// Class 08 - Connection Exception
	CodeConnectionExceptionError                           = "08000"
	CodeConnectionDoesNotExistError                        = "08003"
	CodeConnectionFailureError                             = "08006"
	CodeSQLclientUnableToEstablishSQLconnectionError       = "08001"
	CodeSQLserverRejectedEstablishmentOfSQLconnectionError = "08004"
	CodeTransactionResolutionUnknownError                  = "08007"
	CodeProtocolViolationError                             = "08P01"
	// Class 09 - Triggered Action Exception
	CodeTriggeredActionExceptionError = "09000"
	// Class 0A - Feature Not Supported
	CodeFeatureNotSupportedError = "0A000"
	// Class 0B - Invalid Transaction Initiation
	CodeInvalidTransactionInitiationError = "0B000"
	// Class 0F - Locator Exception
	CodeLocatorExceptionError            = "0F000"
	CodeInvalidLocatorSpecificationError = "0F001"
	// Class 0L - Invalid Grantor
	CodeInvalidGrantorError        = "0L000"
	CodeInvalidGrantOperationError = "0LP01"
	// Class 0P - Invalid Role Specification
	CodeInvalidRoleSpecificationError = "0P000"
	// Class 0Z - Diagnostics Exception
	CodeDiagnosticsExceptionError                           = "0Z000"
	CodeStackedDiagnosticsAccessedWithoutActiveHandlerError = "0Z002"
	// Class 20 - Case Not Found
	CodeCaseNotFoundError = "20000"
	// Class 21 - Cardinality Violation
	CodeCardinalityViolationError = "21000"
	// Class 22 - Data Exception
	CodeDataExceptionError                         = "22000"
	CodeArraySubscriptError                        = "2202E"
	CodeCharacterNotInRepertoireError              = "22021"
	CodeDatetimeFieldOverflowError                 = "22008"
	CodeDivisionByZeroError                        = "22012"
	CodeErrorInAssignmentError                     = "22005"
	CodeEscapeCharacterConflictError               = "2200B"
	CodeIndicatorOverflowError                     = "22022"
	CodeIntervalFieldOverflowError                 = "22015"
	CodeInvalidArgumentForLogarithmError           = "2201E"
	CodeInvalidArgumentForNtileFunctionError       = "22014"
	CodeInvalidArgumentForNthValueFunctionError    = "22016"
	CodeInvalidArgumentForPowerFunctionError       = "2201F"
	CodeInvalidArgumentForWidthBucketFunctionError = "2201G"
	CodeInvalidCharacterValueForCastError          = "22018"
	CodeInvalidDatetimeFormatError                 = "22007"
	CodeInvalidEscapeCharacterError                = "22019"
	CodeInvalidEscapeOctetError                    = "2200D"
	CodeInvalidEscapeSequenceError                 = "22025"
	CodeNonstandardUseOfEscapeCharacterError       = "22P06"
	CodeInvalidIndicatorParameterValueError        = "22010"
	CodeInvalidParameterValueError                 = "22023"
	CodeInvalidRegularExpressionError              = "2201B"
	CodeInvalidRowCountInLimitClauseError          = "2201W"
	CodeInvalidRowCountInResultOffsetClauseError   = "2201X"
	CodeInvalidTimeZoneDisplacementValueError      = "22009"
	CodeInvalidUseOfEscapeCharacterError           = "2200C"
	CodeMostSpecificTypeMismatchError              = "2200G"
	CodeNullValueNotAllowedError                   = "22004"
	CodeNullValueNoIndicatorParameterError         = "22002"
	CodeNumericValueOutOfRangeError                = "22003"
	CodeStringDataLengthMismatchError              = "22026"
	CodeStringDataRightTruncationError             = "22001"
	CodeSubstringError                             = "22011"
	CodeTrimError                                  = "22027"
	CodeUnterminatedCStringError                   = "22024"
	CodeZeroLengthCharacterStringError             = "2200F"
	CodeFloatingPointExceptionError                = "22P01"
	CodeInvalidTextRepresentationError             = "22P02"
	CodeInvalidBinaryRepresentationError           = "22P03"
	CodeBadCopyFileFormatError                     = "22P04"
	CodeUntranslatableCharacterError               = "22P05"
	CodeNotAnXMLDocumentError                      = "2200L"
	CodeInvalidXMLDocumentError                    = "2200M"
	CodeInvalidXMLContentError                     = "2200N"
	CodeInvalidXMLCommentError                     = "2200S"
	CodeInvalidXMLProcessingInstructionError       = "2200T"
	// Class 23 - Integrity Constraint Violation
	CodeIntegrityConstraintViolationError = "23000"
	CodeRestrictViolationError            = "23001"
	CodeNotNullViolationError             = "23502"
	CodeForeignKeyViolationError          = "23503"
	CodeUniqueViolationError              = "23505"
	CodeCheckViolationError               = "23514"
	CodeExclusionViolationError           = "23P01"
	// Class 24 - Invalid Cursor State
	CodeInvalidCursorStateError = "24000"
	// Class 25 - Invalid Transaction State
	CodeInvalidTransactionStateError                         = "25000"
	CodeActiveSQLTransactionError                            = "25001"
	CodeBranchTransactionAlreadyActiveError                  = "25002"
	CodeHeldCursorRequiresSameIsolationLevelError            = "25008"
	CodeInappropriateAccessModeForBranchTransactionError     = "25003"
	CodeInappropriateIsolationLevelForBranchTransactionError = "25004"
	CodeNoActiveSQLTransactionForBranchTransactionError      = "25005"
	CodeReadOnlySQLTransactionError                          = "25006"
	CodeSchemaAndDataStatementMixingNotSupportedError        = "25007"
	CodeNoActiveSQLTransactionError                          = "25P01"
	CodeInFailedSQLTransactionError                          = "25P02"
	// Class 26 - Invalid SQL Statement Name
	CodeInvalidSQLStatementNameError = "26000"
	// Class 27 - Triggered Data Change Violation
	CodeTriggeredDataChangeViolationError = "27000"
	// Class 28 - Invalid Authorization Specification
	CodeInvalidAuthorizationSpecificationError = "28000"
	CodeInvalidPasswordError                   = "28P01"
	// Class 2B - Dependent Privilege Descriptors Still Exist
	CodeDependentPrivilegeDescriptorsStillExistError = "2B000"
	CodeDependentObjectsStillExistError              = "2BP01"
	// Class 2D - Invalid Transaction Termination
	CodeInvalidTransactionTerminationError = "2D000"
	// Class 2F - SQL Routine Exception
	CodeSQLRoutineExceptionError                               = "2F000"
	CodeRoutineExceptionFunctionExecutedNoReturnStatementError = "2F005"
	CodeRoutineExceptionModifyingSQLDataNotPermittedError      = "2F002"
	CodeRoutineExceptionProhibitedSQLStatementAttemptedError   = "2F003"
	CodeRoutineExceptionReadingSQLDataNotPermittedError        = "2F004"
	// Class 34 - Invalid Cursor Name
	CodeInvalidCursorNameError = "34000"
	// Class 38 - External Routine Exception
	CodeExternalRoutineExceptionError                       = "38000"
	CodeExternalRoutineContainingSQLNotPermittedError       = "38001"
	CodeExternalRoutineModifyingSQLDataNotPermittedError    = "38002"
	CodeExternalRoutineProhibitedSQLStatementAttemptedError = "38003"
	CodeExternalRoutineReadingSQLDataNotPermittedError      = "38004"
	// Class 39 - External Routine Invocation Exception
	CodeExternalRoutineInvocationExceptionError     = "39000"
	CodeExternalRoutineInvalidSQLstateReturnedError = "39001"
	CodeExternalRoutineNullValueNotAllowedError     = "39004"
	CodeExternalRoutineTriggerProtocolViolatedError = "39P01"
	CodeExternalRoutineSrfProtocolViolatedError     = "39P02"
	// Class 3B - Savepoint Exception
	CodeSavepointExceptionError            = "3B000"
	CodeInvalidSavepointSpecificationError = "3B001"
	// Class 3D - Invalid Catalog Name
	CodeInvalidCatalogNameError = "3D000"
	// Class 3F - Invalid Schema Name
	CodeInvalidSchemaNameError = "3F000"
	// Class 40 - Transaction Rollback
	CodeTransactionRollbackError                     = "40000"
	CodeTransactionIntegrityConstraintViolationError = "40002"
	CodeSerializationFailureError                    = "40001"
	CodeStatementCompletionUnknownError              = "40003"
	CodeDeadlockDetectedError                        = "40P01"
	// Class 42 - Syntax Error or Access Rule Violation
	CodeSyntaxErrorOrAccessRuleViolationError   = "42000"
	CodeSyntaxError                             = "42601"
	CodeInsufficientPrivilegeError              = "42501"
	CodeCannotCoerceError                       = "42846"
	CodeGroupingError                           = "42803"
	CodeWindowingError                          = "42P20"
	CodeInvalidRecursionError                   = "42P19"
	CodeInvalidForeignKeyError                  = "42830"
	CodeInvalidNameError                        = "42602"
	CodeNameTooLongError                        = "42622"
	CodeReservedNameError                       = "42939"
	CodeDatatypeMismatchError                   = "42804"
	CodeIndeterminateDatatypeError              = "42P18"
	CodeCollationMismatchError                  = "42P21"
	CodeIndeterminateCollationError             = "42P22"
	CodeWrongObjectTypeError                    = "42809"
	CodeUndefinedColumnError                    = "42703"
	CodeUndefinedFunctionError                  = "42883"
	CodeUndefinedTableError                     = "42P01"
	CodeUndefinedParameterError                 = "42P02"
	CodeUndefinedObjectError                    = "42704"
	CodeDuplicateColumnError                    = "42701"
	CodeDuplicateCursorError                    = "42P03"
	CodeDuplicateDatabaseError                  = "42P04"
	CodeDuplicateFunctionError                  = "42723"
	CodeDuplicatePreparedStatementError         = "42P05"
	CodeDuplicateSchemaError                    = "42P06"
	CodeDuplicateRelationError                  = "42P07"
	CodeDuplicateAliasError                     = "42712"
	CodeDuplicateObjectError                    = "42710"
	CodeAmbiguousColumnError                    = "42702"
	CodeAmbiguousFunctionError                  = "42725"
	CodeAmbiguousParameterError                 = "42P08"
	CodeAmbiguousAliasError                     = "42P09"
	CodeInvalidColumnReferenceError             = "42P10"
	CodeInvalidColumnDefinitionError            = "42611"
	CodeInvalidCursorDefinitionError            = "42P11"
	CodeInvalidDatabaseDefinitionError          = "42P12"
	CodeInvalidFunctionDefinitionError          = "42P13"
	CodeInvalidPreparedStatementDefinitionError = "42P14"
	CodeInvalidSchemaDefinitionError            = "42P15"
	CodeInvalidTableDefinitionError             = "42P16"
	CodeInvalidObjectDefinitionError            = "42P17"
	// Class 44 - WITH CHECK OPTION Violation
	CodeWithCheckOptionViolationError = "44000"
	// Class 53 - Insufficient Resources
	CodeInsufficientResourcesError      = "53000"
	CodeDiskFullError                   = "53100"
	CodeOutOfMemoryError                = "53200"
	CodeTooManyConnectionsError         = "53300"
	CodeConfigurationLimitExceededError = "53400"
	// Class 54 - Program Limit Exceeded
	CodeProgramLimitExceededError = "54000"
	CodeStatementTooComplexError  = "54001"
	CodeTooManyColumnsError       = "54011"
	CodeTooManyArgumentsError     = "54023"
	// Class 55 - Object Not In Prerequisite State
	CodeObjectNotInPrerequisiteStateError = "55000"
	CodeObjectInUseError                  = "55006"
	CodeCantChangeRuntimeParamError       = "55P02"
	CodeLockNotAvailableError             = "55P03"
	// Class 57 - Operator Intervention
	CodeOperatorInterventionError = "57000"
	CodeQueryCanceledError        = "57014"
	CodeAdminShutdownError        = "57P01"
	CodeCrashShutdownError        = "57P02"
	CodeCannotConnectNowError     = "57P03"
	CodeDatabaseDroppedError      = "57P04"
	// Class 58 - System Error (errors external to PostgreSQL itself)
	CodeSystemError        = "58000"
	CodeIoError            = "58030"
	CodeUndefinedFileError = "58P01"
	CodeDuplicateFileError = "58P02"
	// Class F0 - Configuration File Error
	CodeConfigFileError     = "F0000"
	CodeLockFileExistsError = "F0001"
	// Class HV - Foreign Data Wrapper Error (SQL/MED)
	CodeFdwError                                  = "HV000"
	CodeFdwColumnNameNotFoundError                = "HV005"
	CodeFdwDynamicParameterValueNeededError       = "HV002"
	CodeFdwFunctionSequenceError                  = "HV010"
	CodeFdwInconsistentDescriptorInformationError = "HV021"
	CodeFdwInvalidAttributeValueError             = "HV024"
	CodeFdwInvalidColumnNameError                 = "HV007"
	CodeFdwInvalidColumnNumberError               = "HV008"
	CodeFdwInvalidDataTypeError                   = "HV004"
	CodeFdwInvalidDataTypeDescriptorsError        = "HV006"
	CodeFdwInvalidDescriptorFieldIdentifierError  = "HV091"
	CodeFdwInvalidHandleError                     = "HV00B"
	CodeFdwInvalidOptionIndexError                = "HV00C"
	CodeFdwInvalidOptionNameError                 = "HV00D"
	CodeFdwInvalidStringLengthOrBufferLengthError = "HV090"
	CodeFdwInvalidStringFormatError               = "HV00A"
	CodeFdwInvalidUseOfNullPointerError           = "HV009"
	CodeFdwTooManyHandlesError                    = "HV014"
	CodeFdwOutOfMemoryError                       = "HV001"
	CodeFdwNoSchemasError                         = "HV00P"
	CodeFdwOptionNameNotFoundError                = "HV00J"
	CodeFdwReplyHandleError                       = "HV00K"
	CodeFdwSchemaNotFoundError                    = "HV00Q"
	CodeFdwTableNotFoundError                     = "HV00R"
	CodeFdwUnableToCreateExecutionError           = "HV00L"
	CodeFdwUnableToCreateReplyError               = "HV00M"
	CodeFdwUnableToEstablishConnectionError       = "HV00N"
	// Class P0 - PL/pgSQL Error
	CodePLpgSQLError        = "P0000"
	CodeRaiseExceptionError = "P0001"
	CodeNoDataFoundError    = "P0002"
	CodeTooManyRowsError    = "P0003"
	// Class XX - Internal Error
	CodeInternalError       = "XX000"
	CodeDataCorruptedError  = "XX001"
	CodeIndexCorruptedError = "XX002"
)

PG error codes from: http://www.postgresql.org/docs/9.5/static/errcodes-appendix.html. Specifically, errcodes.txt is copied from from Postgres' src/backend/utils/errcodes.txt.

The error definitions were generated using the generate.sh script, with a bit of manual tweaking performed afterwards.

Variables

View Source
var (
	ErrInvalidLengthErrors = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowErrors   = fmt.Errorf("proto: integer overflow")
)

Functions

func AnnotateError

func AnnotateError(prefix string, err error) error

AnnotateError adds a prefix to the message of an error, maintaining its pg error code and source if it is a pgerror.Error.

func Unimplemented

func Unimplemented(feature, msg string) error

Unimplemented constructs an unimplemented feature error.

`feature` is used for tracking, and is not included when the error printed.

func UnimplementedWithIssueErrorf

func UnimplementedWithIssueErrorf(issue int, msg string, args ...interface{}) error

UnimplementedWithIssueErrorf constructs an error with the formatted message and a link to the passed issue. Recorded as "#<issue>" in tracking.

Types

type Error

type Error struct {
	Code    string        `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"`
	Message string        `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	Detail  string        `protobuf:"bytes,3,opt,name=detail,proto3" json:"detail,omitempty"`
	Hint    string        `protobuf:"bytes,4,opt,name=hint,proto3" json:"hint,omitempty"`
	Source  *Error_Source `protobuf:"bytes,5,opt,name=source" json:"source,omitempty"`
	// "Internal query: the text of a failed internally-generated command."
	InternalCommand string `protobuf:"bytes,6,opt,name=internalCommand,proto3" json:"internalCommand,omitempty"`
}

Error contains all Postgres wire protocol error fields. See https://www.postgresql.org/docs/current/static/protocol-error-fields.html for a list of all Postgres error fields, most of which are optional and can be used to provide auxiliary error information.

func GetPGCause

func GetPGCause(err error) (*Error, bool)

GetPGCause returns an unwrapped Error.

func NewError

func NewError(code string, msg string) *Error

NewError creates an Error.

func NewErrorf

func NewErrorf(code string, format string, args ...interface{}) *Error

NewErrorf creates an Error with a format string.

func (*Error) Descriptor

func (*Error) Descriptor() ([]byte, []int)

func (*Error) Error

func (pg *Error) Error() string

func (*Error) Marshal

func (m *Error) Marshal() (dAtA []byte, err error)

func (*Error) MarshalTo

func (m *Error) MarshalTo(dAtA []byte) (int, error)

func (*Error) ProtoMessage

func (*Error) ProtoMessage()

func (*Error) Reset

func (m *Error) Reset()

func (*Error) Size

func (m *Error) Size() (n int)

func (*Error) String

func (m *Error) String() string

func (*Error) Unmarshal

func (m *Error) Unmarshal(dAtA []byte) error

type Error_Source

type Error_Source struct {
	File     string `protobuf:"bytes,1,opt,name=file,proto3" json:"file,omitempty"`
	Line     int32  `protobuf:"varint,2,opt,name=line,proto3" json:"line,omitempty"`
	Function string `protobuf:"bytes,3,opt,name=function,proto3" json:"function,omitempty"`
}

func (*Error_Source) Descriptor

func (*Error_Source) Descriptor() ([]byte, []int)

func (*Error_Source) Marshal

func (m *Error_Source) Marshal() (dAtA []byte, err error)

func (*Error_Source) MarshalTo

func (m *Error_Source) MarshalTo(dAtA []byte) (int, error)

func (*Error_Source) ProtoMessage

func (*Error_Source) ProtoMessage()

func (*Error_Source) Reset

func (m *Error_Source) Reset()

func (*Error_Source) Size

func (m *Error_Source) Size() (n int)

func (*Error_Source) String

func (m *Error_Source) String() string

func (*Error_Source) Unmarshal

func (m *Error_Source) Unmarshal(dAtA []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL