pqerror

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package pqerror contains PostgreSQL error codes for use with pq.Error.

Index

Constants

View Source
const (
	SeverityFatal   = "FATAL"
	SeverityPanic   = "PANIC"
	SeverityWarning = "WARNING"
	SeverityNotice  = "NOTICE"
	SeverityDebug   = "DEBUG"
	SeverityInfo    = "INFO"
	SeverityLog     = "LOG"
)

Error severity values.

Variables

View Source
var (
	ClassSuccessfulCompletion                    = Class("00") // Successful Completion
	ClassWarning                                 = Class("01") // Warning
	ClassNoData                                  = Class("02") // No Data (this is also a warning class per the SQL standard)
	ClassSQLStatementNotYetComplete              = Class("03") // SQL Statement Not Yet Complete
	ClassConnectionException                     = Class("08") // Connection Exception
	ClassTriggeredActionException                = Class("09") // Triggered Action Exception
	ClassFeatureNotSupported                     = Class("0A") // Feature Not Supported
	ClassInvalidTransactionInitiation            = Class("0B") // Invalid Transaction Initiation
	ClassLocatorException                        = Class("0F") // Locator Exception
	ClassInvalidGrantor                          = Class("0L") // Invalid Grantor
	ClassInvalidRoleSpecification                = Class("0P") // Invalid Role Specification
	ClassDiagnosticsException                    = Class("0Z") // Diagnostics Exception
	ClassCaseNotFound                            = Class("20") // Case Not Found
	ClassCardinalityViolation                    = Class("21") // Cardinality Violation
	ClassDataException                           = Class("22") // Data Exception
	ClassIntegrityConstraintViolation            = Class("23") // Integrity Constraint Violation
	ClassInvalidCursorState                      = Class("24") // Invalid Cursor State
	ClassInvalidTransactionState                 = Class("25") // Invalid Transaction State
	ClassInvalidSQLStatementName                 = Class("26") // Invalid SQL Statement Name
	ClassTriggeredDataChangeViolation            = Class("27") // Triggered Data Change Violation
	ClassInvalidAuthorizationSpecification       = Class("28") // Invalid Authorization Specification
	ClassDependentPrivilegeDescriptorsStillExist = Class("2B") // Dependent Privilege Descriptors Still Exist
	ClassInvalidTransactionTermination           = Class("2D") // Invalid Transaction Termination
	ClassSQLRoutineException                     = Class("2F") // SQL Routine Exception
	ClassInvalidCursorName                       = Class("34") // Invalid Cursor Name
	ClassExternalRoutineException                = Class("38") // External Routine Exception
	ClassExternalRoutineInvocationException      = Class("39") // External Routine Invocation Exception
	ClassSavepointException                      = Class("3B") // Savepoint Exception
	ClassInvalidCatalogName                      = Class("3D") // Invalid Catalog Name
	ClassInvalidSchemaName                       = Class("3F") // Invalid Schema Name
	ClassTransactionRollback                     = Class("40") // Transaction Rollback
	ClassSyntaxErrorOrAccessRuleViolation        = Class("42") // Syntax Error or Access Rule Violation
	ClassWithCheckOptionViolation                = Class("44") // WITH CHECK OPTION Violation
	ClassInsufficientResources                   = Class("53") // Insufficient Resources
	ClassProgramLimitExceeded                    = Class("54") // Program Limit Exceeded
	ClassObjectNotInPrerequisiteState            = Class("55") // Object Not In Prerequisite State
	ClassOperatorIntervention                    = Class("57") // Operator Intervention
	ClassSystemError                             = Class("58") // System Error (errors external to PostgreSQL itself)
	ClassConfigFileError                         = Class("F0") // Configuration File Error
	ClassFDWError                                = Class("HV") // Foreign Data Wrapper Error (SQL/MED)
	ClassPLpgSQLError                            = Class("P0") // PL/pgSQL Error
	ClassInternalError                           = Class("XX") // Internal Error
)
View Source
var (
	SuccessfulCompletion                            = Code("00000") // Class 00 - Successful Completion
	Warning                                         = Code("01000") // Class 01 - Warning
	WarningDynamicResultSetsReturned                = Code("0100C")
	WarningImplicitZeroBitPadding                   = Code("01008")
	WarningNullValueEliminatedInSetFunction         = Code("01003")
	WarningPrivilegeNotGranted                      = Code("01007")
	WarningPrivilegeNotRevoked                      = Code("01006")
	WarningStringDataRightTruncation                = Code("01004")
	WarningDeprecatedFeature                        = Code("01P01")
	NoData                                          = Code("02000") // Class 02 - No Data (this is also a warning class per the SQL standard)
	NoAdditionalDynamicResultSetsReturned           = Code("02001")
	SQLStatementNotYetComplete                      = Code("03000") // Class 03 - SQL Statement Not Yet Complete
	ConnectionException                             = Code("08000") // Class 08 - Connection Exception
	ConnectionDoesNotExist                          = Code("08003")
	ConnectionFailure                               = Code("08006")
	SQLClientUnableToEstablishSQLConnection         = Code("08001")
	SQLServerRejectedEstablishmentOfSQLConnection   = Code("08004")
	TransactionResolutionUnknown                    = Code("08007")
	ProtocolViolation                               = Code("08P01")
	TriggeredActionException                        = Code("09000") // Class 09 - Triggered Action Exception
	FeatureNotSupported                             = Code("0A000") // Class 0A - Feature Not Supported
	InvalidTransactionInitiation                    = Code("0B000") // Class 0B - Invalid Transaction Initiation
	LocatorException                                = Code("0F000") // Class 0F - Locator Exception
	LEInvalidSpecification                          = Code("0F001")
	InvalidGrantor                                  = Code("0L000") // Class 0L - Invalid Grantor
	InvalidGrantOperation                           = Code("0LP01")
	InvalidRoleSpecification                        = Code("0P000") // Class 0P - Invalid Role Specification
	DiagnosticsException                            = Code("0Z000") // Class 0Z - Diagnostics Exception
	StackedDiagnosticsAccessedWithoutActiveHandler  = Code("0Z002")
	InvalidArgumentForXquery                        = Code("10608")
	CaseNotFound                                    = Code("20000") // Class 20 - Case Not Found
	CardinalityViolation                            = Code("21000") // Class 21 - Cardinality Violation
	DataException                                   = Code("22000") // Class 22 - Data Exception
	ArraySubscriptError                             = Code("2202E")
	CharacterNotInRepertoire                        = Code("22021")
	DatetimeFieldOverflow                           = Code("22008")
	DivisionByZero                                  = Code("22012")
	ErrorInAssignment                               = Code("22005")
	EscapeCharacterConflict                         = Code("2200B")
	IndicatorOverflow                               = Code("22022")
	IntervalFieldOverflow                           = Code("22015")
	InvalidArgumentForLog                           = Code("2201E")
	InvalidArgumentForNtile                         = Code("22014")
	InvalidArgumentForNthValue                      = Code("22016")
	InvalidArgumentForPowerFunction                 = Code("2201F")
	InvalidArgumentForWidthBucketFunction           = Code("2201G")
	InvalidCharacterValueForCast                    = Code("22018")
	InvalidDatetimeFormat                           = Code("22007")
	InvalidEscapeCharacter                          = Code("22019")
	InvalidEscapeOctet                              = Code("2200D")
	InvalidEscapeSequence                           = Code("22025")
	NonstandardUseOfEscapeCharacter                 = Code("22P06")
	InvalidIndicatorParameterValue                  = Code("22010")
	InvalidParameterValue                           = Code("22023")
	InvalidPrecedingOrFollowingSize                 = Code("22013")
	InvalidRegularExpression                        = Code("2201B")
	InvalidRowCountInLimitClause                    = Code("2201W")
	InvalidRowCountInResultOffsetClause             = Code("2201X")
	InvalidTablesampleArgument                      = Code("2202H")
	InvalidTablesampleRepeat                        = Code("2202G")
	InvalidTimeZoneDisplacementValue                = Code("22009")
	InvalidUseOfEscapeCharacter                     = Code("2200C")
	MostSpecificTypeMismatch                        = Code("2200G")
	NullValueNotAllowed                             = Code("22004")
	NullValueNoIndicatorParameter                   = Code("22002")
	NumericValueOutOfRange                          = Code("22003")
	SequenceGeneratorLimitExceeded                  = Code("2200H")
	StringDataLengthMismatch                        = Code("22026")
	StringDataRightTruncation                       = Code("22001")
	SubstringError                                  = Code("22011")
	TrimError                                       = Code("22027")
	UnterminatedCString                             = Code("22024")
	ZeroLengthCharacterString                       = Code("2200F")
	FloatingPointException                          = Code("22P01")
	InvalidTextRepresentation                       = Code("22P02")
	InvalidBinaryRepresentation                     = Code("22P03")
	BadCopyFileFormat                               = Code("22P04")
	UntranslatableCharacter                         = Code("22P05")
	NotAnXMLDocument                                = Code("2200L")
	InvalidXMLDocument                              = Code("2200M")
	InvalidXMLContent                               = Code("2200N")
	InvalidXMLComment                               = Code("2200S")
	InvalidXMLProcessingInstruction                 = Code("2200T")
	DuplicateJSONObjectKeyValue                     = Code("22030")
	InvalidArgumentForSQLJSONDatetimeFunction       = Code("22031")
	InvalidJSONText                                 = Code("22032")
	InvalidSQLJSONSubscript                         = Code("22033")
	MoreThanOneSQLJSONItem                          = Code("22034")
	NoSQLJSONItem                                   = Code("22035")
	NonNumericSQLJSONItem                           = Code("22036")
	NonUniqueKeysInAJSONObject                      = Code("22037")
	SingletonSQLJSONItemRequired                    = Code("22038")
	SQLJSONArrayNotFound                            = Code("22039")
	SQLJSONMemberNotFound                           = Code("2203A")
	SQLJSONNumberNotFound                           = Code("2203B")
	SQLJSONObjectNotFound                           = Code("2203C")
	TooManyJSONArrayElements                        = Code("2203D")
	TooManyJSONObjectMembers                        = Code("2203E")
	SQLJSONScalarRequired                           = Code("2203F")
	SQLJSONItemCannotBeCastToTargetType             = Code("2203G")
	IntegrityConstraintViolation                    = Code("23000") // Class 23 - Integrity Constraint Violation
	RestrictViolation                               = Code("23001")
	NotNullViolation                                = Code("23502")
	ForeignKeyViolation                             = Code("23503")
	UniqueViolation                                 = Code("23505")
	CheckViolation                                  = Code("23514")
	ExclusionViolation                              = Code("23P01")
	InvalidCursorState                              = Code("24000") // Class 24 - Invalid Cursor State
	InvalidTransactionState                         = Code("25000") // Class 25 - Invalid Transaction State
	ActiveSQLTransaction                            = Code("25001")
	BranchTransactionAlreadyActive                  = Code("25002")
	HeldCursorRequiresSameIsolationLevel            = Code("25008")
	InappropriateAccessModeForBranchTransaction     = Code("25003")
	InappropriateIsolationLevelForBranchTransaction = Code("25004")
	NoActiveSQLTransactionForBranchTransaction      = Code("25005")
	ReadOnlySQLTransaction                          = Code("25006")
	SchemaAndDataStatementMixingNotSupported        = Code("25007")
	NoActiveSQLTransaction                          = Code("25P01")
	InFailedSQLTransaction                          = Code("25P02")
	IdleInTransactionSessionTimeout                 = Code("25P03")
	TransactionTimeout                              = Code("25P04")
	InvalidSQLStatementName                         = Code("26000") // Class 26 - Invalid SQL Statement Name
	TriggeredDataChangeViolation                    = Code("27000") // Class 27 - Triggered Data Change Violation
	InvalidAuthorizationSpecification               = Code("28000") // Class 28 - Invalid Authorization Specification
	InvalidPassword                                 = Code("28P01")
	DependentPrivilegeDescriptorsStillExist         = Code("2B000") // Class 2B - Dependent Privilege Descriptors Still Exist
	DependentObjectsStillExist                      = Code("2BP01")
	InvalidTransactionTermination                   = Code("2D000") // Class 2D - Invalid Transaction Termination
	SQLRoutineException                             = Code("2F000") // Class 2F - SQL Routine Exception
	SREFunctionExecutedNoReturnStatement            = Code("2F005")
	SREModifyingSQLDataNotPermitted                 = Code("2F002")
	SREProhibitedSQLStatementAttempted              = Code("2F003")
	SREReadingSQLDataNotPermitted                   = Code("2F004")
	InvalidCursorName                               = Code("34000") // Class 34 - Invalid Cursor Name
	ExternalRoutineException                        = Code("38000") // Class 38 - External Routine Exception
	EREContainingSQLNotPermitted                    = Code("38001")
	EREModifyingSQLDataNotPermitted                 = Code("38002")
	EREProhibitedSQLStatementAttempted              = Code("38003")
	EREReadingSQLDataNotPermitted                   = Code("38004")
	ExternalRoutineInvocationException              = Code("39000") // Class 39 - External Routine Invocation Exception
	ERIEInvalidSQLSTATEReturned                     = Code("39001")
	ERIENullValueNotAllowed                         = Code("39004")
	ERIETriggerProtocolViolated                     = Code("39P01")
	ERIESrfProtocolViolated                         = Code("39P02")
	ERIEEventTriggerProtocolViolated                = Code("39P03")
	SavepointException                              = Code("3B000") // Class 3B - Savepoint Exception
	SEInvalidSpecification                          = Code("3B001")
	InvalidCatalogName                              = Code("3D000") // Class 3D - Invalid Catalog Name
	InvalidSchemaName                               = Code("3F000") // Class 3F - Invalid Schema Name
	TransactionRollback                             = Code("40000") // Class 40 - Transaction Rollback
	TRIntegrityConstraintViolation                  = Code("40002")
	TRSerializationFailure                          = Code("40001")
	TRStatementCompletionUnknown                    = Code("40003")
	TRDeadlockDetected                              = Code("40P01")
	SyntaxErrorOrAccessRuleViolation                = Code("42000") // Class 42 - Syntax Error or Access Rule Violation
	SyntaxError                                     = Code("42601")
	InsufficientPrivilege                           = Code("42501")
	CannotCoerce                                    = Code("42846")
	GroupingError                                   = Code("42803")
	WindowingError                                  = Code("42P20")
	InvalidRecursion                                = Code("42P19")
	InvalidForeignKey                               = Code("42830")
	InvalidName                                     = Code("42602")
	NameTooLong                                     = Code("42622")
	ReservedName                                    = Code("42939")
	DatatypeMismatch                                = Code("42804")
	IndeterminateDatatype                           = Code("42P18")
	CollationMismatch                               = Code("42P21")
	IndeterminateCollation                          = Code("42P22")
	WrongObjectType                                 = Code("42809")
	GeneratedAlways                                 = Code("428C9")
	UndefinedColumn                                 = Code("42703")
	UndefinedFunction                               = Code("42883")
	UndefinedTable                                  = Code("42P01")
	UndefinedParameter                              = Code("42P02")
	UndefinedObject                                 = Code("42704")
	DuplicateColumn                                 = Code("42701")
	DuplicateCursor                                 = Code("42P03")
	DuplicateDatabase                               = Code("42P04")
	DuplicateFunction                               = Code("42723")
	DuplicatePstatement                             = Code("42P05")
	DuplicateSchema                                 = Code("42P06")
	DuplicateTable                                  = Code("42P07")
	DuplicateAlias                                  = Code("42712")
	DuplicateObject                                 = Code("42710")
	AmbiguousColumn                                 = Code("42702")
	AmbiguousFunction                               = Code("42725")
	AmbiguousParameter                              = Code("42P08")
	AmbiguousAlias                                  = Code("42P09")
	InvalidColumnReference                          = Code("42P10")
	InvalidColumnDefinition                         = Code("42611")
	InvalidCursorDefinition                         = Code("42P11")
	InvalidDatabaseDefinition                       = Code("42P12")
	InvalidFunctionDefinition                       = Code("42P13")
	InvalidPstatementDefinition                     = Code("42P14")
	InvalidSchemaDefinition                         = Code("42P15")
	InvalidTableDefinition                          = Code("42P16")
	InvalidObjectDefinition                         = Code("42P17")
	WithCheckOptionViolation                        = Code("44000") // Class 44 - WITH CHECK OPTION Violation
	InsufficientResources                           = Code("53000") // Class 53 - Insufficient Resources
	DiskFull                                        = Code("53100")
	OutOfMemory                                     = Code("53200")
	TooManyConnections                              = Code("53300")
	ConfigurationLimitExceeded                      = Code("53400")
	ProgramLimitExceeded                            = Code("54000") // Class 54 - Program Limit Exceeded
	StatementTooComplex                             = Code("54001")
	TooManyColumns                                  = Code("54011")
	TooManyArguments                                = Code("54023")
	ObjectNotInPrerequisiteState                    = Code("55000") // Class 55 - Object Not In Prerequisite State
	ObjectInUse                                     = Code("55006")
	CantChangeRuntimeParam                          = Code("55P02")
	LockNotAvailable                                = Code("55P03")
	UnsafeNewEnumValueUsage                         = Code("55P04")
	OperatorIntervention                            = Code("57000") // Class 57 - Operator Intervention
	QueryCanceled                                   = Code("57014")
	AdminShutdown                                   = Code("57P01")
	CrashShutdown                                   = Code("57P02")
	CannotConnectNow                                = Code("57P03")
	DatabaseDropped                                 = Code("57P04")
	IdleSessionTimeout                              = Code("57P05")
	SystemError                                     = Code("58000") // Class 58 - System Error (errors external to PostgreSQL itself)
	IOError                                         = Code("58030")
	UndefinedFile                                   = Code("58P01")
	DuplicateFile                                   = Code("58P02")
	FileNameTooLong                                 = Code("58P03")
	ConfigFileError                                 = Code("F0000") // Class F0 - Configuration File Error
	LockFileExists                                  = Code("F0001")
	FDWError                                        = Code("HV000") // Class HV - Foreign Data Wrapper Error (SQL/MED)
	FDWColumnNameNotFound                           = Code("HV005")
	FDWDynamicParameterValueNeeded                  = Code("HV002")
	FDWFunctionSequenceError                        = Code("HV010")
	FDWInconsistentDescriptorInformation            = Code("HV021")
	FDWInvalidAttributeValue                        = Code("HV024")
	FDWInvalidColumnName                            = Code("HV007")
	FDWInvalidColumnNumber                          = Code("HV008")
	FDWInvalidDataType                              = Code("HV004")
	FDWInvalidDataTypeDescriptors                   = Code("HV006")
	FDWInvalidDescriptorFieldIdentifier             = Code("HV091")
	FDWInvalidHandle                                = Code("HV00B")
	FDWInvalidOptionIndex                           = Code("HV00C")
	FDWInvalidOptionName                            = Code("HV00D")
	FDWInvalidStringLengthOrBufferLength            = Code("HV090")
	FDWInvalidStringFormat                          = Code("HV00A")
	FDWInvalidUseOfNullPointer                      = Code("HV009")
	FDWTooManyHandles                               = Code("HV014")
	FDWOutOfMemory                                  = Code("HV001")
	FDWNoSchemas                                    = Code("HV00P")
	FDWOptionNameNotFound                           = Code("HV00J")
	FDWReplyHandle                                  = Code("HV00K")
	FDWSchemaNotFound                               = Code("HV00Q")
	FDWTableNotFound                                = Code("HV00R")
	FDWUnableToCreateExecution                      = Code("HV00L")
	FDWUnableToCreateReply                          = Code("HV00M")
	FDWUnableToEstablishConnection                  = Code("HV00N")
	PLpgSQLError                                    = Code("P0000") // Class P0 - PL/pgSQL Error
	RaiseException                                  = Code("P0001")
	NoDataFound                                     = Code("P0002")
	TooManyRows                                     = Code("P0003")
	AssertFailure                                   = Code("P0004")
	InternalError                                   = Code("XX000") // Class XX - Internal Error
	DataCorrupted                                   = Code("XX001")
	IndexCorrupted                                  = Code("XX002")
)

A list of all error codes used in PostgreSQL.

Functions

This section is empty.

Types

type Class

type Class string

Class is only the class part of an error code.

func (Class) Name

func (ec Class) Name() string

Name returns the condition name of an error class. It is equivalent to the condition name of the "standard" error code (i.e. the one having the last three characters "000").

type Code

type Code string

Code is a five-character error code.

func (Code) Class

func (ec Code) Class() Class

Class returns the error class, e.g. "28".

func (Code) Name

func (ec Code) Name() string

Name returns a more human friendly rendering of the error code, namely the "condition name".

Jump to

Keyboard shortcuts

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