qlcodes 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +130 -0
- package/build.sh +122 -0
- package/package.json +24 -0
- package/qlCodes.json +1 -0
- package/references/IBM_errors.csv +710 -0
- package/references/ORACLE_errors.csv +171 -0
- package/references/PSQL_errors.csv +284 -0
- package/src/compose.mjs +113 -0
- package/src/fileTransformer/sanitize.mjs +10 -0
- package/src/fileTransformer/sanitize2.mjs +17 -0
- package/src/fileTransformer/stopNamedKeys.mjs +15 -0
- package/src/generate.cjs +42 -0
- package/src/index.mjs +31 -0
- package/src/pretty.mjs +18 -0
- package/src/readFile.mjs +4 -0
- package/src/regex.mjs +11 -0
- package/src/utils/args.mjs +32 -0
- package/src/utils/codeName.mjs +55 -0
- package/src/utils/io.mjs +11 -0
- package/src/utils/str.mjs +5 -0
- package/types/index.d.ts +31 -0
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
0;successful completion;ORA-00000;;;;
|
|
2
|
+
1000;warning;;;;;
|
|
3
|
+
1001;cursor operation conflict;;;;;
|
|
4
|
+
1002;disconnect error;;;;;
|
|
5
|
+
1003;null value eliminated in set function;;;;;
|
|
6
|
+
1004;string data - right truncation;;;;;
|
|
7
|
+
1005;insufficient item descriptor areas;;;;;
|
|
8
|
+
1006;privilege not revoked;;;;;
|
|
9
|
+
1007;privilege not granted;;;;;
|
|
10
|
+
1008;implicit zero-bit padding;;;;;
|
|
11
|
+
1009;search condition too long for info schema;;;;;
|
|
12
|
+
0100A;query expression too long for info schema;;;;;
|
|
13
|
+
2000;no data;"ORA-01095
|
|
14
|
+
ORA-01403";;;;
|
|
15
|
+
7000;dynamic SQL error;;;;;
|
|
16
|
+
7001;using clause does not match parameter specs;;;;;
|
|
17
|
+
7002;using clause does not match target specs;;;;;
|
|
18
|
+
7003;cursor specification cannot be executed;;;;;
|
|
19
|
+
7004;using clause required for dynamic parameters;;;;;
|
|
20
|
+
7005;prepared statement not a cursor specification;;;;;
|
|
21
|
+
7006;restricted datatype attribute violation;;;;;
|
|
22
|
+
7007;using clause required for result fields;;;;;
|
|
23
|
+
7008;invalid descriptor count;SQL-02126;;;;
|
|
24
|
+
7009;invalid descriptor index;;;;;
|
|
25
|
+
8000;connection exception;;;;;
|
|
26
|
+
8001;SQL client unable to establish SQL connection;;;;;
|
|
27
|
+
8002;connection name in use;;;;;
|
|
28
|
+
8003;connection does not exist;SQL-02121;;;;
|
|
29
|
+
8004;SQL server rejected SQL connection;;;;;
|
|
30
|
+
8006;connection failure;;;;;
|
|
31
|
+
8007;transaction resolution unknown;;;;;
|
|
32
|
+
0A000;feature not supported;ORA-03000 .. 03099;;;;
|
|
33
|
+
0A001;multiple server transactions;;;;;
|
|
34
|
+
21000;cardinality violation;"ORA-01427
|
|
35
|
+
SQL-02112";;;;
|
|
36
|
+
22000;data exception;;;;;
|
|
37
|
+
22001;string data - right truncation;"ORA-01401
|
|
38
|
+
ORA-01406";;;;
|
|
39
|
+
22002;null value - no indicator parameter;"ORA-01405
|
|
40
|
+
SQL-02124";;;;
|
|
41
|
+
22003;numeric value out of range;"ORA-01426
|
|
42
|
+
ORA-01438
|
|
43
|
+
ORA-01455
|
|
44
|
+
ORA-01457";;;;
|
|
45
|
+
22005;error in assignment;;;;;
|
|
46
|
+
22007;invalid date-time format;;;;;
|
|
47
|
+
22008;date-time field overflow;ORA-01800 .. 01899;;;;
|
|
48
|
+
22009;invalid time zone displacement value;;;;;
|
|
49
|
+
22011;substring error;;;;;
|
|
50
|
+
22012;division by zero;ORA-01476;;;;
|
|
51
|
+
22015;interval field overflow;;;;;
|
|
52
|
+
22018;invalid character value for cast;;;;;
|
|
53
|
+
22019;invalid escape character;"ORA-00911
|
|
54
|
+
ORA-01425";;;;
|
|
55
|
+
22021;character not in repertoire;;;;;
|
|
56
|
+
22022;indicator overflow;ORA-01411;;;;
|
|
57
|
+
22023;invalid parameter value;"ORA-01025
|
|
58
|
+
ORA-01488
|
|
59
|
+
ORA-04000 .. 04019";;;;
|
|
60
|
+
22024;unterminated C string;ORA-01479 .. 01480;;;;
|
|
61
|
+
22025;invalid escape sequence;ORA-01424;;;;
|
|
62
|
+
22026;string data - length mismatch;;;;;
|
|
63
|
+
22027;trim error;;;;;
|
|
64
|
+
23000;integrity constraint violation;"ORA-00001
|
|
65
|
+
ORA-02290 .. 02299";;;;
|
|
66
|
+
24000;invalid cursor state;"ORA-01001 .. 01003
|
|
67
|
+
ORA-01410
|
|
68
|
+
ORA-08006
|
|
69
|
+
SQL-02114
|
|
70
|
+
SQL-02117
|
|
71
|
+
SQL-02118
|
|
72
|
+
SQL-02122";;;;
|
|
73
|
+
25000;invalid transaction state;;;;;
|
|
74
|
+
26000;invalid SQL statement name;;;;;
|
|
75
|
+
27000;triggered data change violation;;;;;
|
|
76
|
+
28000;invalid authorization specification;;;;;
|
|
77
|
+
2A000;direct SQL syntax error or access rule violation;;;;;
|
|
78
|
+
2B000;dependent privilege descriptors still exist;;;;;
|
|
79
|
+
2C000;invalid character set name;;;;;
|
|
80
|
+
2D000;invalid transaction termination;;;;;
|
|
81
|
+
"2E000";invalid connection name;;;;;
|
|
82
|
+
33000;invalid SQL descriptor name;;;;;
|
|
83
|
+
34000;invalid cursor name;;;;;
|
|
84
|
+
35000;invalid condition number;;;;;
|
|
85
|
+
37000;dynamic SQL syntax error or access rule violation;;;;;
|
|
86
|
+
3C000;ambiguous cursor name;;;;;
|
|
87
|
+
3D000;invalid catalog name;;;;;
|
|
88
|
+
3F000;invalid schema name;;;;;
|
|
89
|
+
40000;transaction rollback;ORA-02091 .. 02092;;;;
|
|
90
|
+
40001;serialization failure;;;;;
|
|
91
|
+
40002;integrity constraint violation;;;;;
|
|
92
|
+
40003;statement completion unknown;;;;;
|
|
93
|
+
42000;syntax error or access rule violation;"ORA-00022
|
|
94
|
+
ORA-00251
|
|
95
|
+
ORA-00900 .. 00999
|
|
96
|
+
ORA-01031
|
|
97
|
+
ORA-01490 .. 01493
|
|
98
|
+
ORA-01700 .. 01799
|
|
99
|
+
ORA-01900 .. 02099
|
|
100
|
+
ORA-02140 .. 02289
|
|
101
|
+
ORA-02420 .. 02424
|
|
102
|
+
ORA-02450 .. 02499
|
|
103
|
+
ORA-03276 .. 03299
|
|
104
|
+
ORA-04040 .. 04059
|
|
105
|
+
ORA-04070 .. 04099";;;;
|
|
106
|
+
44000;with check option violation;ORA-01402;;;;
|
|
107
|
+
60000;system errors;"ORA-00370 .. 00429
|
|
108
|
+
ORA-00600 .. 00899
|
|
109
|
+
ORA-06430 .. 06449
|
|
110
|
+
ORA-07200 .. 07999
|
|
111
|
+
ORA-09700 .. 09999";;;;
|
|
112
|
+
61000;resource error;"ORA-00018 .. 00035
|
|
113
|
+
ORA-00050 .. 00068
|
|
114
|
+
ORA-02376 .. 02399
|
|
115
|
+
ORA-04020 .. 04039";;;;
|
|
116
|
+
62000;path name server and detached process errors;"ORA-00100 .. 00120
|
|
117
|
+
ORA-00440 .. 00569";;;;
|
|
118
|
+
63000;Oracle*XA and two-task interface errors;"ORA-00150 .. 00159
|
|
119
|
+
SQL-02128
|
|
120
|
+
ORA-02700 .. 02899
|
|
121
|
+
ORA-03100 .. 03199
|
|
122
|
+
ORA-06200 .. 06249";;;;
|
|
123
|
+
64000;"control file, database file, and redo file errors;
|
|
124
|
+
archival and media recovery errors";"ORA-00200 .. 00369
|
|
125
|
+
ORA-01100 .. 01250";;;;
|
|
126
|
+
65000;PL/SQL errors;ORA-06500 .. 06599;;;;
|
|
127
|
+
66000;SQL*Net driver errors;"ORA-06000 .. 06149
|
|
128
|
+
ORA-06250 .. 06429
|
|
129
|
+
ORA-06600 .. 06999
|
|
130
|
+
ORA-12100 .. 12299
|
|
131
|
+
ORA-12500 .. 12599";;;;
|
|
132
|
+
67000;licensing errors;ORA-00430 .. 00439;;;;
|
|
133
|
+
69000;SQL*Connect errors;"ORA-00570 .. 00599
|
|
134
|
+
ORA-07000 .. 07199";;;;
|
|
135
|
+
72000;SQL execute phase errors;"ORA-01000 .. 01099
|
|
136
|
+
ORA-01400 .. 01489
|
|
137
|
+
ORA-01495 .. 01499
|
|
138
|
+
ORA-01500 .. 01699
|
|
139
|
+
ORA-02400 .. 02419
|
|
140
|
+
ORA-02425 .. 02449
|
|
141
|
+
ORA-04060 .. 04069
|
|
142
|
+
ORA-08000 .. 08190
|
|
143
|
+
ORA-12000 .. 12019
|
|
144
|
+
ORA-12300 .. 12499
|
|
145
|
+
ORA-12700 .. 21999";;;;
|
|
146
|
+
82100;out of memory (could not allocate);SQL-02100;;;;
|
|
147
|
+
82101;inconsistent cursor cache: unit cursor/global cursor mismatch;SQL-02101;;;;
|
|
148
|
+
82102;inconsistent cursor cache: no global cursor entry;SQL-02102;;;;
|
|
149
|
+
82103;inconsistent cursor cache: out of range cursor cache reference;SQL-02103;;;;
|
|
150
|
+
82104;inconsistent host cache: no cursor cache available;SQL-02104;;;;
|
|
151
|
+
82105;inconsistent cursor cache: global cursor not found;SQL-02105;;;;
|
|
152
|
+
82106;inconsistent cursor cache: invalid Oracle cursor number;SQL-02106;;;;
|
|
153
|
+
82107;program too old for runtime library;SQL-02107;;;;
|
|
154
|
+
82108;invalid descriptor passed to runtime library;SQL-02108;;;;
|
|
155
|
+
82109;inconsistent host cache: host reference is out of range;SQL-02109;;;;
|
|
156
|
+
82110;inconsistent host cache: invalid host cache entry type;SQL-02110;;;;
|
|
157
|
+
82111;heap consistency error;SQL-02111;;;;
|
|
158
|
+
82112;unable to open message file;SQL-02113;;;;
|
|
159
|
+
82113;code generation internal consistency failed;SQL-02115;;;;
|
|
160
|
+
82114;reentrant code generator gave invalid context;SQL-02116;;;;
|
|
161
|
+
82115;invalid hstdef argument;SQL-02119;;;;
|
|
162
|
+
82116;first and second arguments to sqlrcn both null;SQL-02120;;;;
|
|
163
|
+
82117;invalid OPEN or PREPARE for this connection;SQL-02122;;;;
|
|
164
|
+
82118;application context not found;SQL-02123;;;;
|
|
165
|
+
82119;"connect error; can't get error text";SQL-02125;;;;
|
|
166
|
+
82120;precompiler/SQLLIB version mismatch.;SQL-02127;;;;
|
|
167
|
+
82121;FETCHed number of bytes is odd;SQL-02129;;;;
|
|
168
|
+
82122;EXEC TOOLS interface is not available;SQL-02130;;;;
|
|
169
|
+
90000;debug events;ORA-10000 .. 10999;;;;
|
|
170
|
+
99999;catch all;all others;;;;
|
|
171
|
+
HZ000;remote database access;;;;;
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
Error Code;Condition Name
|
|
2
|
+
Class 00 — Successful Completion;
|
|
3
|
+
0;successful_completion
|
|
4
|
+
Class 01 — Warning;
|
|
5
|
+
1000;warning
|
|
6
|
+
0100C;dynamic_result_sets_returned
|
|
7
|
+
1008;implicit_zero_bit_padding
|
|
8
|
+
1003;null_value_eliminated_in_set_function
|
|
9
|
+
1007;privilege_not_granted
|
|
10
|
+
1006;privilege_not_revoked
|
|
11
|
+
1004;string_data_right_truncation
|
|
12
|
+
01P01;deprecated_feature
|
|
13
|
+
Class 02 — No Data (this is also a warning class per the SQL standard);
|
|
14
|
+
2000;no_data
|
|
15
|
+
2001;no_additional_dynamic_result_sets_returned
|
|
16
|
+
Class 03 — SQL Statement Not Yet Complete;
|
|
17
|
+
3000;sql_statement_not_yet_complete
|
|
18
|
+
Class 08 — Connection Exception;
|
|
19
|
+
8000;connection_exception
|
|
20
|
+
8003;connection_does_not_exist
|
|
21
|
+
8006;connection_failure
|
|
22
|
+
8001;sqlclient_unable_to_establish_sqlconnection
|
|
23
|
+
8004;sqlserver_rejected_establishment_of_sqlconnection
|
|
24
|
+
8007;transaction_resolution_unknown
|
|
25
|
+
08P01;protocol_violation
|
|
26
|
+
Class 09 — Triggered Action Exception;
|
|
27
|
+
9000;triggered_action_exception
|
|
28
|
+
Class 0A — Feature Not Supported;
|
|
29
|
+
0A000;feature_not_supported
|
|
30
|
+
Class 0B — Invalid Transaction Initiation;
|
|
31
|
+
0B000;invalid_transaction_initiation
|
|
32
|
+
Class 0F — Locator Exception;
|
|
33
|
+
0F000;locator_exception
|
|
34
|
+
0F001;invalid_locator_specification
|
|
35
|
+
Class 0L — Invalid Grantor;
|
|
36
|
+
0L000;invalid_grantor
|
|
37
|
+
0LP01;invalid_grant_operation
|
|
38
|
+
Class 0P — Invalid Role Specification;
|
|
39
|
+
0P000;invalid_role_specification
|
|
40
|
+
Class 0Z — Diagnostics Exception;
|
|
41
|
+
0Z000;diagnostics_exception
|
|
42
|
+
0Z002;stacked_diagnostics_accessed_without_active_handler
|
|
43
|
+
Class 20 — Case Not Found;
|
|
44
|
+
20000;case_not_found
|
|
45
|
+
Class 21 — Cardinality Violation;
|
|
46
|
+
21000;cardinality_violation
|
|
47
|
+
Class 22 — Data Exception;
|
|
48
|
+
22000;data_exception
|
|
49
|
+
2202E;array_subscript_error
|
|
50
|
+
22021;character_not_in_repertoire
|
|
51
|
+
22008;datetime_field_overflow
|
|
52
|
+
22012;division_by_zero
|
|
53
|
+
22005;error_in_assignment
|
|
54
|
+
2200B;escape_character_conflict
|
|
55
|
+
22022;indicator_overflow
|
|
56
|
+
22015;interval_field_overflow
|
|
57
|
+
2201E;invalid_argument_for_logarithm
|
|
58
|
+
22014;invalid_argument_for_ntile_function
|
|
59
|
+
22016;invalid_argument_for_nth_value_function
|
|
60
|
+
2201F;invalid_argument_for_power_function
|
|
61
|
+
2201G;invalid_argument_for_width_bucket_function
|
|
62
|
+
22018;invalid_character_value_for_cast
|
|
63
|
+
22007;invalid_datetime_format
|
|
64
|
+
22019;invalid_escape_character
|
|
65
|
+
2200D;invalid_escape_octet
|
|
66
|
+
22025;invalid_escape_sequence
|
|
67
|
+
22P06;nonstandard_use_of_escape_character
|
|
68
|
+
22010;invalid_indicator_parameter_value
|
|
69
|
+
22023;invalid_parameter_value
|
|
70
|
+
2201B;invalid_regular_expression
|
|
71
|
+
2201W;invalid_row_count_in_limit_clause
|
|
72
|
+
2201X;invalid_row_count_in_result_offset_clause
|
|
73
|
+
2202H;invalid_tablesample_argument
|
|
74
|
+
2202G;invalid_tablesample_repeat
|
|
75
|
+
22009;invalid_time_zone_displacement_value
|
|
76
|
+
2200C;invalid_use_of_escape_character
|
|
77
|
+
2200G;most_specific_type_mismatch
|
|
78
|
+
22004;null_value_not_allowed
|
|
79
|
+
22002;null_value_no_indicator_parameter
|
|
80
|
+
22003;numeric_value_out_of_range
|
|
81
|
+
2200H;sequence_generator_limit_exceeded
|
|
82
|
+
22026;string_data_length_mismatch
|
|
83
|
+
22001;string_data_right_truncation
|
|
84
|
+
22011;substring_error
|
|
85
|
+
22027;trim_error
|
|
86
|
+
22024;unterminated_c_string
|
|
87
|
+
2200F;zero_length_character_string
|
|
88
|
+
22P01;floating_point_exception
|
|
89
|
+
22P02;invalid_text_representation
|
|
90
|
+
22P03;invalid_binary_representation
|
|
91
|
+
22P04;bad_copy_file_format
|
|
92
|
+
22P05;untranslatable_character
|
|
93
|
+
2200L;not_an_xml_document
|
|
94
|
+
2200M;invalid_xml_document
|
|
95
|
+
2200N;invalid_xml_content
|
|
96
|
+
2200S;invalid_xml_comment
|
|
97
|
+
2200T;invalid_xml_processing_instruction
|
|
98
|
+
Class 23 — Integrity Constraint Violation;
|
|
99
|
+
23000;integrity_constraint_violation
|
|
100
|
+
23001;restrict_violation
|
|
101
|
+
23502;not_null_violation
|
|
102
|
+
23503;foreign_key_violation
|
|
103
|
+
23505;unique_violation
|
|
104
|
+
23514;check_violation
|
|
105
|
+
23P01;exclusion_violation
|
|
106
|
+
Class 24 — Invalid Cursor State;
|
|
107
|
+
24000;invalid_cursor_state
|
|
108
|
+
Class 25 — Invalid Transaction State;
|
|
109
|
+
25000;invalid_transaction_state
|
|
110
|
+
25001;active_sql_transaction
|
|
111
|
+
25002;branch_transaction_already_active
|
|
112
|
+
25008;held_cursor_requires_same_isolation_level
|
|
113
|
+
25003;inappropriate_access_mode_for_branch_transaction
|
|
114
|
+
25004;inappropriate_isolation_level_for_branch_transaction
|
|
115
|
+
25005;no_active_sql_transaction_for_branch_transaction
|
|
116
|
+
25006;read_only_sql_transaction
|
|
117
|
+
25007;schema_and_data_statement_mixing_not_supported
|
|
118
|
+
25P01;no_active_sql_transaction
|
|
119
|
+
25P02;in_failed_sql_transaction
|
|
120
|
+
25P03;idle_in_transaction_session_timeout
|
|
121
|
+
Class 26 — Invalid SQL Statement Name;
|
|
122
|
+
26000;invalid_sql_statement_name
|
|
123
|
+
Class 27 — Triggered Data Change Violation;
|
|
124
|
+
27000;triggered_data_change_violation
|
|
125
|
+
Class 28 — Invalid Authorization Specification;
|
|
126
|
+
28000;invalid_authorization_specification
|
|
127
|
+
28P01;invalid_password
|
|
128
|
+
Class 2B — Dependent Privilege Descriptors Still Exist;
|
|
129
|
+
2B000;dependent_privilege_descriptors_still_exist
|
|
130
|
+
2BP01;dependent_objects_still_exist
|
|
131
|
+
Class 2D — Invalid Transaction Termination;
|
|
132
|
+
2D000;invalid_transaction_termination
|
|
133
|
+
Class 2F — SQL Routine Exception;
|
|
134
|
+
2F000;sql_routine_exception
|
|
135
|
+
2F005;function_executed_no_return_statement
|
|
136
|
+
2F002;modifying_sql_data_not_permitted
|
|
137
|
+
2F003;prohibited_sql_statement_attempted
|
|
138
|
+
2F004;reading_sql_data_not_permitted
|
|
139
|
+
Class 34 — Invalid Cursor Name;
|
|
140
|
+
34000;invalid_cursor_name
|
|
141
|
+
Class 38 — External Routine Exception;
|
|
142
|
+
38000;external_routine_exception
|
|
143
|
+
38001;containing_sql_not_permitted
|
|
144
|
+
38002;modifying_sql_data_not_permitted
|
|
145
|
+
38003;prohibited_sql_statement_attempted
|
|
146
|
+
38004;reading_sql_data_not_permitted
|
|
147
|
+
Class 39 — External Routine Invocation Exception;
|
|
148
|
+
39000;external_routine_invocation_exception
|
|
149
|
+
39001;invalid_sqlstate_returned
|
|
150
|
+
39004;null_value_not_allowed
|
|
151
|
+
39P01;trigger_protocol_violated
|
|
152
|
+
39P02;srf_protocol_violated
|
|
153
|
+
39P03;event_trigger_protocol_violated
|
|
154
|
+
Class 3B — Savepoint Exception;
|
|
155
|
+
3B000;savepoint_exception
|
|
156
|
+
3B001;invalid_savepoint_specification
|
|
157
|
+
Class 3D — Invalid Catalog Name;
|
|
158
|
+
3D000;invalid_catalog_name
|
|
159
|
+
Class 3F — Invalid Schema Name;
|
|
160
|
+
3F000;invalid_schema_name
|
|
161
|
+
Class 40 — Transaction Rollback;
|
|
162
|
+
40000;transaction_rollback
|
|
163
|
+
40002;transaction_integrity_constraint_violation
|
|
164
|
+
40001;serialization_failure
|
|
165
|
+
40003;statement_completion_unknown
|
|
166
|
+
40P01;deadlock_detected
|
|
167
|
+
Class 42 — Syntax Error or Access Rule Violation;
|
|
168
|
+
42000;syntax_error_or_access_rule_violation
|
|
169
|
+
42601;syntax_error
|
|
170
|
+
42501;insufficient_privilege
|
|
171
|
+
42846;cannot_coerce
|
|
172
|
+
42803;grouping_error
|
|
173
|
+
42P20;windowing_error
|
|
174
|
+
42P19;invalid_recursion
|
|
175
|
+
42830;invalid_foreign_key
|
|
176
|
+
42602;invalid_name
|
|
177
|
+
42622;name_too_long
|
|
178
|
+
42939;reserved_name
|
|
179
|
+
42804;datatype_mismatch
|
|
180
|
+
42P18;indeterminate_datatype
|
|
181
|
+
42P21;collation_mismatch
|
|
182
|
+
42P22;indeterminate_collation
|
|
183
|
+
42809;wrong_object_type
|
|
184
|
+
428C9;generated_always
|
|
185
|
+
42703;undefined_column
|
|
186
|
+
42883;undefined_function
|
|
187
|
+
42P01;undefined_table
|
|
188
|
+
42P02;undefined_parameter
|
|
189
|
+
42704;undefined_object
|
|
190
|
+
42701;duplicate_column
|
|
191
|
+
42P03;duplicate_cursor
|
|
192
|
+
42P04;duplicate_database
|
|
193
|
+
42723;duplicate_function
|
|
194
|
+
42P05;duplicate_prepared_statement
|
|
195
|
+
42P06;duplicate_schema
|
|
196
|
+
42P07;duplicate_table
|
|
197
|
+
42712;duplicate_alias
|
|
198
|
+
42710;duplicate_object
|
|
199
|
+
42702;ambiguous_column
|
|
200
|
+
42725;ambiguous_function
|
|
201
|
+
42P08;ambiguous_parameter
|
|
202
|
+
42P09;ambiguous_alias
|
|
203
|
+
42P10;invalid_column_reference
|
|
204
|
+
42611;invalid_column_definition
|
|
205
|
+
42P11;invalid_cursor_definition
|
|
206
|
+
42P12;invalid_database_definition
|
|
207
|
+
42P13;invalid_function_definition
|
|
208
|
+
42P14;invalid_prepared_statement_definition
|
|
209
|
+
42P15;invalid_schema_definition
|
|
210
|
+
42P16;invalid_table_definition
|
|
211
|
+
42P17;invalid_object_definition
|
|
212
|
+
Class 44 — WITH CHECK OPTION Violation;
|
|
213
|
+
44000;with_check_option_violation
|
|
214
|
+
Class 53 — Insufficient Resources;
|
|
215
|
+
53000;insufficient_resources
|
|
216
|
+
53100;disk_full
|
|
217
|
+
53200;out_of_memory
|
|
218
|
+
53300;too_many_connections
|
|
219
|
+
53400;configuration_limit_exceeded
|
|
220
|
+
Class 54 — Program Limit Exceeded;
|
|
221
|
+
54000;program_limit_exceeded
|
|
222
|
+
54001;statement_too_complex
|
|
223
|
+
54011;too_many_columns
|
|
224
|
+
54023;too_many_arguments
|
|
225
|
+
Class 55 — Object Not In Prerequisite State;
|
|
226
|
+
55000;object_not_in_prerequisite_state
|
|
227
|
+
55006;object_in_use
|
|
228
|
+
55P02;cant_change_runtime_param
|
|
229
|
+
55P03;lock_not_available
|
|
230
|
+
Class 57 — Operator Intervention;
|
|
231
|
+
57000;operator_intervention
|
|
232
|
+
57014;query_canceled
|
|
233
|
+
57P01;admin_shutdown
|
|
234
|
+
57P02;crash_shutdown
|
|
235
|
+
57P03;cannot_connect_now
|
|
236
|
+
57P04;database_dropped
|
|
237
|
+
Class 58 — System Error (errors external to PostgreSQL itself);
|
|
238
|
+
58000;system_error
|
|
239
|
+
58030;io_error
|
|
240
|
+
58P01;undefined_file
|
|
241
|
+
58P02;duplicate_file
|
|
242
|
+
Class 72 — Snapshot Failure;
|
|
243
|
+
72000;snapshot_too_old
|
|
244
|
+
Class F0 — Configuration File Error;
|
|
245
|
+
F0000;config_file_error
|
|
246
|
+
F0001;lock_file_exists
|
|
247
|
+
Class HV — Foreign Data Wrapper Error (SQL/MED);
|
|
248
|
+
HV000;fdw_error
|
|
249
|
+
HV005;fdw_column_name_not_found
|
|
250
|
+
HV002;fdw_dynamic_parameter_value_needed
|
|
251
|
+
HV010;fdw_function_sequence_error
|
|
252
|
+
HV021;fdw_inconsistent_descriptor_information
|
|
253
|
+
HV024;fdw_invalid_attribute_value
|
|
254
|
+
HV007;fdw_invalid_column_name
|
|
255
|
+
HV008;fdw_invalid_column_number
|
|
256
|
+
HV004;fdw_invalid_data_type
|
|
257
|
+
HV006;fdw_invalid_data_type_descriptors
|
|
258
|
+
HV091;fdw_invalid_descriptor_field_identifier
|
|
259
|
+
HV00B;fdw_invalid_handle
|
|
260
|
+
HV00C;fdw_invalid_option_index
|
|
261
|
+
HV00D;fdw_invalid_option_name
|
|
262
|
+
HV090;fdw_invalid_string_length_or_buffer_length
|
|
263
|
+
HV00A;fdw_invalid_string_format
|
|
264
|
+
HV009;fdw_invalid_use_of_null_pointer
|
|
265
|
+
HV014;fdw_too_many_handles
|
|
266
|
+
HV001;fdw_out_of_memory
|
|
267
|
+
HV00P;fdw_no_schemas
|
|
268
|
+
HV00J;fdw_option_name_not_found
|
|
269
|
+
HV00K;fdw_reply_handle
|
|
270
|
+
HV00Q;fdw_schema_not_found
|
|
271
|
+
HV00R;fdw_table_not_found
|
|
272
|
+
HV00L;fdw_unable_to_create_execution
|
|
273
|
+
HV00M;fdw_unable_to_create_reply
|
|
274
|
+
HV00N;fdw_unable_to_establish_connection
|
|
275
|
+
Class P0 — PL/pgSQL Error;
|
|
276
|
+
P0000;plpgsql_error
|
|
277
|
+
P0001;raise_exception
|
|
278
|
+
P0002;no_data_found
|
|
279
|
+
P0003;too_many_rows
|
|
280
|
+
P0004;assert_failure
|
|
281
|
+
Class XX — Internal Error;
|
|
282
|
+
XX000;internal_error
|
|
283
|
+
XX001;data_corrupted
|
|
284
|
+
XX002;index_corrupted
|
package/src/compose.mjs
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import { onStdIn } from "./utils/io.mjs";
|
|
3
|
+
import { CODE_RE, CLASS_RE, COMMENT_RE } from "./regex.mjs";
|
|
4
|
+
import { reargv } from "./utils/args.mjs";
|
|
5
|
+
const argv = reargv();
|
|
6
|
+
function flushBuffer(buffer, currentClass, currentCode) {
|
|
7
|
+
if (!buffer.length) return buffer;
|
|
8
|
+
|
|
9
|
+
const reason = buffer.join("\n").trim();
|
|
10
|
+
if (currentCode && !/(\w+_)+/.test(reason)) {
|
|
11
|
+
currentCode.reason = reason;
|
|
12
|
+
} else if (currentClass && !/(\w+_)+/.test(reason)) {
|
|
13
|
+
currentClass.reason = reason;
|
|
14
|
+
}
|
|
15
|
+
return [];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const apply = (text, errors = {}) => {
|
|
19
|
+
let buffer = [];
|
|
20
|
+
let currentClass = null;
|
|
21
|
+
let currentCode = null;
|
|
22
|
+
|
|
23
|
+
for (const rawLine of text.split(/\r?\n/)) {
|
|
24
|
+
const line = rawLine.trimEnd();
|
|
25
|
+
|
|
26
|
+
// Ignore comment lines entirely
|
|
27
|
+
if (COMMENT_RE.test(line)) {
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Class line
|
|
32
|
+
const classMatch = line.match(CLASS_RE);
|
|
33
|
+
if (classMatch) {
|
|
34
|
+
buffer = flushBuffer(buffer, currentClass, currentCode);
|
|
35
|
+
|
|
36
|
+
const { classCode, label } = classMatch.groups;
|
|
37
|
+
|
|
38
|
+
currentClass = errors[classCode]
|
|
39
|
+
? errors[classCode]
|
|
40
|
+
: {
|
|
41
|
+
label,
|
|
42
|
+
errorSet: [],
|
|
43
|
+
};
|
|
44
|
+
errors[classCode] = currentClass;
|
|
45
|
+
currentCode = null;
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Error code line
|
|
50
|
+
const codeMatch = line.match(CODE_RE);
|
|
51
|
+
if (codeMatch) {
|
|
52
|
+
buffer = flushBuffer(buffer, currentClass, currentCode);
|
|
53
|
+
|
|
54
|
+
let { code, key, flags } = codeMatch.groups;
|
|
55
|
+
const foundCode = currentClass.errorSet.find((x) => x.code == code);
|
|
56
|
+
const use = flags.split(":").filter((x) => x);
|
|
57
|
+
|
|
58
|
+
key = key.substring(1);
|
|
59
|
+
currentCode = foundCode || {
|
|
60
|
+
code,
|
|
61
|
+
keys: [],
|
|
62
|
+
use,
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
if (key != "_" && !currentCode.keys.includes(key)) {
|
|
66
|
+
currentCode.keys.push(key);
|
|
67
|
+
}
|
|
68
|
+
if (foundCode) {
|
|
69
|
+
currentCode.use = [...foundCode.use, ...use];
|
|
70
|
+
}
|
|
71
|
+
if (!foundCode) {
|
|
72
|
+
currentClass.errorSet.push(currentCode);
|
|
73
|
+
}
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// reason line (non-empty, non-comment)
|
|
78
|
+
if (line !== "") {
|
|
79
|
+
buffer.push(line);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Flush trailing reason
|
|
84
|
+
buffer = flushBuffer(buffer, currentClass, currentCode);
|
|
85
|
+
return errors;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const debugInFile = (file, data = null) => {
|
|
89
|
+
const isDebug = process.env.DEBUG;
|
|
90
|
+
if (isDebug) {
|
|
91
|
+
const fileName = file.replaceAll("../", "");
|
|
92
|
+
fs.writeFileSync(fileName + ".debug.json", data);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
if (argv.options.file || argv.files.length) {
|
|
96
|
+
const file = argv.options.file || argv.files[0];
|
|
97
|
+
|
|
98
|
+
onStdIn((content) => {
|
|
99
|
+
const isDebug = process.env.DEBUG;
|
|
100
|
+
let errors;
|
|
101
|
+
try {
|
|
102
|
+
errors = JSON.parse(content ? content : "{}");
|
|
103
|
+
} catch {
|
|
104
|
+
errors = {};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
debugInFile(file, JSON.stringify(errors, null, isDebug ? 2 : 0));
|
|
108
|
+
|
|
109
|
+
console.log(
|
|
110
|
+
JSON.stringify(apply(fs.readFileSync(file, "utf8"), errors), null, 2)
|
|
111
|
+
);
|
|
112
|
+
});
|
|
113
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { insertHeadersAndFormat } from "../utils/codeName.mjs";
|
|
2
|
+
import { onStdIn } from "../utils/io.mjs";
|
|
3
|
+
|
|
4
|
+
onStdIn((input) => {
|
|
5
|
+
console.log(
|
|
6
|
+
insertHeadersAndFormat(
|
|
7
|
+
input
|
|
8
|
+
.replaceAll(/\n/gm, "\\")
|
|
9
|
+
.replaceAll(/;".+"/gm, "")
|
|
10
|
+
.replaceAll(/(?:;+$)/gm, "")
|
|
11
|
+
.replaceAll(`"`, "")
|
|
12
|
+
.replaceAll("\\", "\n")
|
|
13
|
+
.replaceAll("\r", "")
|
|
14
|
+
.trim()
|
|
15
|
+
)
|
|
16
|
+
);
|
|
17
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { onStdIn } from "../utils/io.mjs";
|
|
2
|
+
|
|
3
|
+
onStdIn((input) => {
|
|
4
|
+
console.log(
|
|
5
|
+
input
|
|
6
|
+
.replaceAll(/ use_of_| the_| an_| a_|for_the_|_the|of_the_/gm, "")
|
|
7
|
+
.replaceAll(/there_are_|there_is/gm, "")
|
|
8
|
+
.replaceAll(/in_|is_|are_/gm, "")
|
|
9
|
+
.replaceAll(/on_a_/gm, "")
|
|
10
|
+
.replaceAll(/has_been_/gm, "")
|
|
11
|
+
.replaceAll(/use_of_a_/gm, "")
|
|
12
|
+
.replaceAll(/_use_of_a|_use_of_an/gm, "")
|
|
13
|
+
.replaceAll(/_use_of_|_an_/gm, "_")
|
|
14
|
+
);
|
|
15
|
+
});
|
package/src/generate.cjs
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
const { ERROR_CODE_HEADER_RGX } = require("./regex.mjs");
|
|
3
|
+
const { newCode } = require("./utils/codeName.mjs");
|
|
4
|
+
const { reargv } = require("./utils/args.mjs");
|
|
5
|
+
const { onStdIn } = require("./utils/io.mjs");
|
|
6
|
+
|
|
7
|
+
const argv = reargv();
|
|
8
|
+
|
|
9
|
+
const processCSVLines = (fileCSVText) => {
|
|
10
|
+
let output = [];
|
|
11
|
+
let currentClassCode = null;
|
|
12
|
+
for (const line of fileCSVText.split(/\r?\n/)) {
|
|
13
|
+
if (!line.trim()) continue;
|
|
14
|
+
|
|
15
|
+
const [code] = line.split(";", 2);
|
|
16
|
+
|
|
17
|
+
let match;
|
|
18
|
+
if ((match = ERROR_CODE_HEADER_RGX.exec(code))) {
|
|
19
|
+
let { label, class_code } = match.groups;
|
|
20
|
+
|
|
21
|
+
label = label.replace(/^Unqualified\s+/i, "");
|
|
22
|
+
output.push("", `Class ${class_code} — ${label}`);
|
|
23
|
+
|
|
24
|
+
currentClassCode = class_code;
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (!currentClassCode) continue;
|
|
29
|
+
|
|
30
|
+
output.push(...newCode(line, currentClassCode));
|
|
31
|
+
}
|
|
32
|
+
return output.join("\n");
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
if (argv.options.file || argv.files.length) {
|
|
36
|
+
const file = argv.options.file || argv.files[0];
|
|
37
|
+
console.log(processCSVLines(fs.readFileSync(file, "utf8")));
|
|
38
|
+
} else {
|
|
39
|
+
onStdIn((csv) => {
|
|
40
|
+
console.log(processCSVLines(csv));
|
|
41
|
+
});
|
|
42
|
+
}
|
package/src/index.mjs
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import data from "../qlCodes.json" with { type : "json" };
|
|
2
|
+
export const lens = (code) => {
|
|
3
|
+
let error = {
|
|
4
|
+
code: "-1",
|
|
5
|
+
keys: [],
|
|
6
|
+
use: [],
|
|
7
|
+
reason: `The code '${code}' does not match any entries in qlcodes. This may be a qlcode issue only to provide you with the correct information`,
|
|
8
|
+
};
|
|
9
|
+
try {
|
|
10
|
+
if (
|
|
11
|
+
code == "" ||
|
|
12
|
+
(!code && code != "0") ||
|
|
13
|
+
!/[A-Z0-9]{5}/.test(`${code}`.padStart(5, "0"))
|
|
14
|
+
)
|
|
15
|
+
throw "qlcodes_malformed";
|
|
16
|
+
const paddedCode = `${code}`.padStart(5, "0");
|
|
17
|
+
const search = Object.entries(data).find(([id]) =>
|
|
18
|
+
new RegExp(`^${id}`).test(paddedCode)
|
|
19
|
+
);
|
|
20
|
+
if (!search) {
|
|
21
|
+
throw "qlcodes_no_class_found";
|
|
22
|
+
}
|
|
23
|
+
const [_, foundClass] = search;
|
|
24
|
+
if (foundClass)
|
|
25
|
+
error = foundClass.errorSet.find((x) => (x.code = paddedCode));
|
|
26
|
+
else throw "qlcodes_no_code_found";
|
|
27
|
+
} catch (err) {
|
|
28
|
+
error.keys = [typeof err == "string" ? err : "qlcodes_unexpected_error"];
|
|
29
|
+
}
|
|
30
|
+
return error;
|
|
31
|
+
};
|
package/src/pretty.mjs
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import { reargv } from "./utils/args.mjs";
|
|
3
|
+
import { onStdIn } from "./utils/io.mjs";
|
|
4
|
+
|
|
5
|
+
const isDebug = process.env.DEBUG === "true";
|
|
6
|
+
const argv = reargv();
|
|
7
|
+
|
|
8
|
+
if (argv.options.file || argv.files.length) {
|
|
9
|
+
const file = argv.options.file || argv.files[0];
|
|
10
|
+
|
|
11
|
+
onStdIn((content) => {
|
|
12
|
+
fs.writeFile(
|
|
13
|
+
file,
|
|
14
|
+
JSON.stringify(JSON.parse(content), null, isDebug ? 2 : undefined),
|
|
15
|
+
(_) => {}
|
|
16
|
+
);
|
|
17
|
+
});
|
|
18
|
+
}
|