1.1.2 • Public • Published

PostgreSQL Response Codes

Scarf: Downloads Scarf: Commercial Users

Utility to interact with PostgreSQL response codes.


Once you require this module, you may call it with either a PostgreSQL response code or a response name. With a code, you will get the code name while with a code name you will get a PostgreSQL response code. It's that simple!!!



API Sample

const PostgresResponseCodes = require('postgres-response-codes');

// Print "Unique Violation"

// Print "23505"

PostgreSQL Error Codes

Class 00 — Successful Completion

'00000': 'Successful Completion',

Class 01 — Warning

'01000': 'Warning',
'WARNING': '01000',

'0100C': 'Dynamic Result Sets Returned',

'01008': 'Implicit Zero Bit Padding',

'01003': 'Null Value Eliminated In Set Function',

'01007': 'Privilege Not Granted',

'01006': 'Privilege Not Revoked',

'01004': 'String Data Right Truncation',

'01P01': 'Deprecated Feature',

Class 02 — No Data (this is also a warning class per the SQL standard)

'02000': 'No Data',
'NO_DATA': '02000',

'02001': 'No Additional Dynamic Result Sets Returned',

Class 03 — SQL Statement Not Yet Complete

'03000': 'SQL Statement Not Yet Complete',

Class 08 — Connection Exception

'08000': 'Connection Exception',

'08003': 'Connection Does Not Exist',

'08006': 'Connection Failure',

'08001': 'Sqlclient Unable To Establish Sqlconnection',

'08004': 'Sqlserver Rejected Establishment Of Sqlconnection',

'08007': 'Transaction Resolution Unknown',

'08P01': 'Protocol Violation',

Class 09 — Triggered Action Exception

'09000': 'Triggered Action Exception',

Class 0A — Feature Not Supported

'0A000': 'Feature Not Supported',

Class 0B — Invalid Transaction Initiation

'0B000': 'Invalid Transaction Initiation',

Class 0F — Locator Exception

'0F000': 'Locator Exception',

'0F001': 'Invalid Locator Specification',

Class 0L — Invalid Grantor

'0L000': 'Invalid Grantor',

'0LP01': 'Invalid Grant Operation',

Class 0P — Invalid Role Specification

'0P000': 'Invalid Role Specification',

Class 0Z — Diagnostics Exception

'0Z000': 'Diagnostics Exception',

'0Z002': 'Stacked Diagnostics Accessed Without Active Handler',

Class 20 — Case Not Found

'20000': 'Case Not Found',
'CASE_NOT_FOUND': '20000',

Class 21 — Cardinality Violation

'21000': 'Cardinality Violation',

Class 22 — Data Exception

'22000': 'Data Exception',
'DATA_EXCEPTION': '22000',

'2202E': 'Array Subscript Error',

'22021': 'Character Not In Repertoire',

'22008': 'Datetime Field Overflow',

'22012': 'Division By Zero',
'DIVISION_BY_ZERO': '22012',

'22005': 'Error In Assignment',

'2200B': 'Escape Character Conflict',

'22022': 'Indicator Overflow',

'22015': 'Interval Field Overflow',

'2201E': 'Invalid Argument For Logarithm',

'22014': 'Invalid Argument For Ntile Function',

'22016': 'Invalid Argument For Nth Value Function',

'2201F': 'Invalid Argument For Power Function',

'2201G': 'Invalid Argument For Width Bucket Function',

'22018': 'Invalid Character Value For Cast',

'22007': 'Invalid Datetime Format',

'22019': 'Invalid Escape Character',

'2200D': 'Invalid Escape Octet',

'22025': 'Invalid Escape Sequence',

'22P06': 'Nonstandard Use Of Escape Character',

'22010': 'Invalid Indicator Parameter Value',

'22023': 'Invalid Parameter Value',

'2201B': 'Invalid Regular Expression',

'2201W': 'Invalid Row Count In Limit Clause',

'2201X': 'Invalid Row Count In Result Offset Clause',

'22009': 'Invalid Time Zone Displacement Value',

'2200C': 'Invalid Use Of Escape Character',

'2200G': 'Most Specific Type Mismatch',

'22004': 'Null Value Not Allowed',

'22002': 'Null Value No Indicator Parameter',

'22003': 'Numeric Value Out Of Range',

'22026': 'String Data Length Mismatch',

'22001': 'String Data Right Truncation',

'22011': 'Substring Error',

'22027': 'Trim Error',
'TRIM_ERROR': '22027',

'22024': 'Unterminated C String',

'2200F': 'Zero Length Character String',

'22P01': 'Floating Point Exception',

'22P02': 'Invalid Text Representation',

'22P03': 'Invalid Binary Representation',

'22P04': 'Bad Copy File Format',

'22P05': 'Untranslatable Character',

'2200L': 'Not An XML Document',

'2200M': 'Invalid XML Document',

'2200N': 'Invalid XML Content',

'2200S': 'Invalid XML Comment',

'2200T': 'Invalid XML Processing Instruction',

Class 23 — Integrity Constraint Violation

'23000': 'Integrity Constraint Violation',

'23001': 'Restrict Violation',

'23502': 'Not Null Violation',

'23503': 'Foreign Key Violation',

'23505': 'Unique Violation',

'23514': 'Check Violation',

'23P01': 'Exclusion Violation',

Class 24 — Invalid Cursor State

'24000': 'Invalid Cursor State',

Class 25 — Invalid Transaction State

'25000': 'Invalid Transaction State',

'25001': 'Active SQL Transaction',

'25002': 'Branch Transaction Already Active',

'25008': 'Held Cursor Requires Same Isolation Level',

'25003': 'Inappropriate Access Mode For Branch Transaction',

'25004': 'Inappropriate Isolation Level For Branch Transaction',

'25005': 'No Active SQL Transaction For Branch Transaction',

'25006': 'Read Only SQL Transaction',

'25007': 'Schema And Data Statement Mixing Not Supported',

'25P01': 'No Active SQL Transaction',

'25P02': 'In Failed SQL Transaction',

Class 26 — Invalid SQL Statement Name

'26000': 'Invalid SQL Statement Name',

Class 27 — Triggered Data Change Violation

'27000': 'Triggered Data Change Violation',

Class 28 — Invalid Authorization Specification

'28000': 'Invalid Authorization Specification',

'28P01': 'Invalid Password',

Class 2B — Dependent Privilege Descriptors Still Exist

'2B000': 'Dependent Privilege Descriptors Still Exist',

'2BP01': 'Dependent Objects Still Exist',

Class 2D — Invalid Transaction Termination

'2D000': 'Invalid Transaction Termination',

Class 2F — SQL Routine Exception

'2F000': 'SQL Routine Exception',

'2F005': 'Function Executed No Return Statement',

'2F002': 'Modifying SQL Data Not Permitted',

'2F003': 'Prohibited SQL Statement Attempted',

'2F004': 'Reading SQL Data Not Permitted',

Class 34 — Invalid Cursor Name

'34000': 'Invalid Cursor Name',

Class 38 — External Routine Exception

'38000': 'External Routine Exception',

'38001': 'Containing SQL Not Permitted',

'38002': 'Modifying SQL Data Not Permitted',

'38003': 'Prohibited SQL Statement Attempted',

'38004': 'Reading SQL Data Not Permitted',

Class 39 — External Routine Invocation Exception

'39000': 'External Routine Invocation Exception',

'39001': 'Invalid SQLstate Returned',

'39004': 'Null Value Not Allowed',

'39P01': 'Trigger Protocol Violated',

'39P02': 'SRF Protocol Violated',

Class 3B — Savepoint Exception

'3B000': 'Savepoint Exception',

'3B001': 'Invalid Savepoint Specification',

Class 3D — Invalid Catalog Name

'3D000': 'Invalid Catalog Name',

Class 3F — Invalid Schema Name

'3F000': 'Invalid Schema Name',

Class 40 — Transaction Rollback

'40000': 'Transaction Rollback',

'40002': 'Transaction Integrity Constraint Violation',

'40001': 'Serialization Failure',

'40003': 'Statement Completion Unknown',

'40P01': 'Deadlock Detected',

Class 42 — Syntax Error or Access Rule Violation

'42000': 'Syntax Error Or Access Rule Violation',

'42601': 'Syntax Error',
'SYNTAX_ERROR': '42601',

'42501': 'Insufficient Privilege',

'42846': 'Cannot Coerce',
'CANNOT_COERCE': '42846',

'42803': 'Grouping Error',
'GROUPING_ERROR': '42803',

'42P20': 'Windowing Error',

'42P19': 'Invalid Recursion',

'42830': 'Invalid Foreign Key',

'42602': 'Invalid Name',
'INVALID_NAME': '42602',

'42622': 'Name Too Long',
'NAME_TOO_LONG': '42622',

'42939': 'Reserved Name',
'RESERVED_NAME': '42939',

'42804': 'Datatype Mismatch',

'42P18': 'Indeterminate Datatype',

'42P21': 'Collation Mismatch',

'42P22': 'Indeterminate Collation',

'42809': 'Wrong Object Type',

'42703': 'Undefined Column',

'42883': 'Undefined Function',

'42P01': 'Undefined Table',

'42P02': 'Undefined Parameter',

'42704': 'Undefined Object',

'42701': 'Duplicate Column',

'42P03': 'Duplicate Cursor',

'42P04': 'Duplicate Database',

'42723': 'Duplicate Function',

'42P05': 'Duplicate Prepared Statement',

'42P06': 'Duplicate Schema',

'42P07': 'Duplicate Table',

'42712': 'Duplicate Alias',

'42710': 'Duplicate Object',

'42702': 'Ambiguous Column',

'42725': 'Ambiguous Function',

'42P08': 'Ambiguous Parameter',

'42P09': 'Ambiguous Alias',

'42P10': 'Invalid Column Reference',

'42611': 'Invalid Column Definition',

'42P11': 'Invalid Cursor Definition',

'42P12': 'Invalid Database Definition',

'42P13': 'Invalid Function Definition',

'42P14': 'Invalid Prepared Statement Definition',

'42P15': 'Invalid Schema Definition',

'42P16': 'Invalid Table Definition',

'42P17': 'Invalid Object Definition',

Class 44 — WITH CHECK OPTION Violation

'44000': 'With Check Option Violation',

Class 53 — Insufficient Resources

'53000': 'Insufficient Resources',

'53100': 'Disk Full',
'DISK_FULL': '53100',

'53200': 'Out Of Memory',
'OUT_OF_MEMORY': '53200',

'53300': 'Too Many Connections',

'53400': 'Configuration Limit Exceeded',

Class 54 — Program Limit Exceeded

'54000': 'Program Limit Exceeded',

'54001': 'Statement Too Complex',

'54011': 'Too Many Columns',
'TOO_MANY_COLUMNS': '54011',

'54023': 'Too Many Arguments',

Class 55 — Object Not In Prerequisite State

'55000': 'Object Not In Prerequisite State',

'55006': 'Object In Use',
'OBJECT_IN_USE': '55006',

'55P02': 'Cant Change Runtime Param',

'55P03': 'Lock Not Available',

Class 57 — Operator Intervention

'57000': 'Operator Intervention',

'57014': 'Query Canceled',
'QUERY_CANCELED': '57014',

'57P01': 'Admin Shutdown',

'57P02': 'Crash Shutdown',

'57P03': 'Cannot Connect Now',

'57P04': 'Database Dropped',

Class 58 — System Error (errors external to PostgreSQL itself)

'58000': 'System Error',
'SYSTEM_ERROR': '58000',

'58030': 'IO Error',
'IO_ERROR': '58030',

'58P01': 'Undefined File',

'58P02': 'Duplicate File',

Class F0 — Configuration File Error

'F0000': 'Config File Error',

'F0001': 'Lock File Exists',

Class HV — Foreign Data Wrapper Error (SQL/MED)

'HV000': 'FDW Error',
'FDW_ERROR': 'HV000',

'HV005': 'FDW Column Name Not Found',

'HV002': 'FDW Dynamic Parameter Value Needed',

'HV010': 'FDW Function Sequence Error',

'HV021': 'FDW Inconsistent Descriptor Information',

'HV024': 'FDW Invalid Attribute Value',

'HV007': 'FDW Invalid Column Name',

'HV008': 'FDW Invalid Column Number',

'HV004': 'FDW Invalid Data Type',

'HV006': 'FDW Invalid Data Type Descriptors',

'HV091': 'FDW Invalid Descriptor Field Identifier',

'HV00B': 'FDW Invalid Handle',

'HV00C': 'FDW Invalid Option Index',

'HV00D': 'FDW Invalid Option Name',

'HV090': 'FDW Invalid String Length Or Buffer Length',

'HV00A': 'FDW Invalid String Format',

'HV009': 'FDW Invalid Use Of Null Pointer',

'HV014': 'FDW Too Many Handles',

'HV001': 'FDW Out Of Memory',

'HV00P': 'FDW No Schemas',

'HV00J': 'FDW Option Name Not Found',

'HV00K': 'FDW Reply Handle',

'HV00Q': 'FDW Schema Not Found',

'HV00R': 'FDW Table Not Found',

'HV00L': 'FDW Unable To Create Execution',

'HV00M': 'FDW Unable To Create Reply',

'HV00N': 'FDW Unable To Establish Connection',

Class P0 — PL/pgSQL Error

'P0000': 'PLpgSQL Error',

'P0001': 'Raise Exception',

'P0002': 'No Data Found',
'NO_DATA_FOUND': 'P0002',

'P0003': 'Too Many Rows',
'TOO_MANY_ROWS': 'P0003',

Class XX — Internal Error

'XX000': 'Internal Error',

'XX001': 'Data Corrupted',

'XX002': 'Index Corrupted',



npm i postgres-response-codes

DownloadsWeekly Downloads






Unpacked Size

45.9 kB

Total Files


Last publish


  • hollyos7