Repository navigation
Expand file tree
/
Copy patherrors.py
More file actions
1782 lines (1263 loc) · 45.5 KB
/
Copy patherrors.py
File metadata and controls
1782 lines (1263 loc) · 45.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
"""
psycopg exceptions
DBAPI-defined Exceptions are defined in the following hierarchy::
Exceptions
|__Warning
|__Error
|__InterfaceError
|__DatabaseError
|__DataError
|__OperationalError
|__IntegrityError
|__InternalError
|__ProgrammingError
|__NotSupportedError
"""
# Copyright (C) 2020 The Psycopg Team
from __future__ import annotations
from typing import TYPE_CHECKING, Any, NoReturn, TypeAlias, TypeGuard
from asyncio import CancelledError
from dataclasses import dataclass, field, fields
from collections.abc import Callable, Sequence
from .pq.abc import PGconn, PGresult
from .pq._enums import ConnStatus, DiagnosticField, PipelineStatus, TransactionStatus
if TYPE_CHECKING:
from .pq.misc import ConninfoOption, PGnotify
ErrorInfo: TypeAlias = PGresult | dict[int, bytes | None] | None
_sqlcodes: dict[str, type[Error]] = {}
@dataclass
class FinishedPGconn:
"""Finished libpq connection.
Attributes are set from a real `~psycopg.pq.PGconn` but any operations will
raise an `~psycopg.OperationalError`.
"""
info: list[ConninfoOption] = field(default_factory=list)
db: bytes = b""
user: bytes = b""
password: bytes = b""
host: bytes = b""
hostaddr: bytes = b""
port: bytes = b""
tty: bytes = b""
options: bytes = b""
status: int = ConnStatus.BAD.value
transaction_status: int = TransactionStatus.UNKNOWN.value
pipeline_status: int = PipelineStatus.OFF.value
error_message: bytes = b""
_encoding: str = "utf-8"
protocol_version: int = 0
full_protocol_version: int = 0
server_version: int = 0
backend_pid: int = 0
needs_password: bool = False
used_password: bool = False
used_gssapi: bool = False
ssl_in_use: bool = False
nonblocking: int = 0
notice_handler: Callable[[PGresult], None] | None = None
notify_handler: Callable[[PGnotify], None] | None = None
@staticmethod
def _raise() -> NoReturn:
raise OperationalError("the connection is closed")
@classmethod
def connect(cls, *args: Any) -> NoReturn:
raise TypeError(f"{cls} is unusable")
@classmethod
def connect_start(cls, *args: Any) -> NoReturn:
raise TypeError(f"{cls} is unusable")
def connect_poll(self) -> NoReturn:
self._raise()
def finish(self) -> None:
pass
def reset(self) -> NoReturn:
self._raise()
def get_error_message(self, encoding: str = "") -> str:
return "the connection is closed"
def reset_start(self) -> NoReturn:
self._raise()
def reset_poll(self) -> NoReturn:
self._raise()
@classmethod
def ping(cls, *args: Any) -> NoReturn:
raise TypeError(f"{cls} is unusable")
def parameter_status(self, *args: Any) -> NoReturn:
self._raise()
@property
def socket(self) -> NoReturn:
self._raise()
def exec_(self, *args: Any) -> NoReturn:
self._raise()
def send_query(self, *args: Any) -> None:
self._raise()
def exec_params(self, *args: Any) -> NoReturn:
self._raise()
def send_query_params(self, *args: Any) -> NoReturn:
self._raise()
def send_prepare(self, *args: Any) -> NoReturn:
self._raise()
def send_query_prepared(self, *args: Any) -> NoReturn:
self._raise()
def prepare(self, *args: Any) -> NoReturn:
self._raise()
def exec_prepared(self, *args: Any) -> NoReturn:
self._raise()
def describe_prepared(self, *args: Any) -> NoReturn:
self._raise()
def send_describe_prepared(self, *args: Any) -> NoReturn:
self._raise()
def describe_portal(self, *args: Any) -> NoReturn:
self._raise()
def send_describe_portal(self, *args: Any) -> NoReturn:
self._raise()
def close_prepared(self, *args: Any) -> NoReturn:
self._raise()
def send_close_prepared(self, *args: Any) -> NoReturn:
self._raise()
def close_portal(self, *args: Any) -> NoReturn:
self._raise()
def send_close_portal(self, *args: Any) -> NoReturn:
self._raise()
def get_result(self) -> NoReturn:
self._raise()
def consume_input(self) -> NoReturn:
self._raise()
def is_busy(self) -> NoReturn:
self._raise()
def flush(self) -> NoReturn:
self._raise()
def set_single_row_mode(self) -> NoReturn:
self._raise()
def set_chunked_rows_mode(self, size: int) -> NoReturn:
self._raise()
def cancel_conn(self) -> NoReturn:
self._raise()
def get_cancel(self) -> NoReturn:
self._raise()
def notifies(self) -> NoReturn:
self._raise()
def put_copy_data(self, *args: Any) -> NoReturn:
self._raise()
def put_copy_end(self, *args: Any) -> NoReturn:
self._raise()
def get_copy_data(self, *args: Any) -> NoReturn:
self._raise()
def trace(self, *args: Any) -> NoReturn:
self._raise()
def set_trace_flags(self, *args: Any) -> NoReturn:
self._raise()
def untrace(self) -> NoReturn:
self._raise()
def encrypt_password(self, *args: Any) -> NoReturn:
self._raise()
def change_password(self, *args: Any) -> NoReturn:
self._raise()
def make_empty_result(self, *args: Any) -> NoReturn:
self._raise()
def enter_pipeline_mode(self) -> NoReturn:
self._raise()
def exit_pipeline_mode(self) -> NoReturn:
self._raise()
def pipeline_sync(self) -> NoReturn:
self._raise()
def send_flush_request(self) -> NoReturn:
self._raise()
def finish_pgconn(pgconn: PGconn) -> PGconn:
args = {}
for f in fields(FinishedPGconn):
try:
args[f.name] = getattr(pgconn, f.name)
except Exception:
pass
pgconn.finish()
return FinishedPGconn(**args)
class Warning(Exception):
"""
Exception raised for important warnings.
Defined for DBAPI compatibility, but never raised by ``psycopg``.
"""
__module__ = "psycopg"
class Error(Exception):
"""
Base exception for all the errors psycopg will raise.
Exception that is the base class of all other error exceptions. You can
use this to catch all errors with one single `!except` statement.
This exception is guaranteed to be picklable.
"""
__module__ = "psycopg"
sqlstate: str | None = None
def __init__(
self,
*args: Sequence[Any],
info: ErrorInfo = None,
encoding: str = "utf-8",
pgconn: PGconn | None = None,
):
super().__init__(*args)
self._info = info
self._encoding = encoding
self._pgconn = pgconn
# Handle sqlstate codes for which we don't have a class.
if not self.sqlstate and info:
self.sqlstate = self.diag.sqlstate
@property
def pgconn(self) -> PGconn | None:
"""The connection object, if the error was raised from a connection attempt.
:rtype: psycopg.pq.PGconn | None
"""
return self._pgconn if self._pgconn else None
@property
def pgresult(self) -> PGresult | None:
"""The result object, if the exception was raised after a failed query.
:rtype: psycopg.pq.PGresult | None
"""
return self._info if _is_pgresult(self._info) else None
@property
def diag(self) -> Diagnostic:
"""
A `Diagnostic` object to inspect details of the errors from the database.
"""
return Diagnostic(self._info, encoding=self._encoding)
def __reduce__(self) -> str | tuple[Any, ...]:
res = super().__reduce__()
if isinstance(res, tuple) and len(res) >= 3:
# To make the exception picklable
res[2]["_info"] = _info_to_dict(self._info)
res[2]["_pgconn"] = None
return res
class InterfaceError(Error):
"""
An error related to the database interface rather than the database itself.
"""
__module__ = "psycopg"
class DatabaseError(Error):
"""
Exception raised for errors that are related to the database.
"""
__module__ = "psycopg"
def __init_subclass__(cls, code: str | None = None, name: str | None = None):
if code:
_sqlcodes[code] = cls
cls.sqlstate = code
if name:
_sqlcodes[name] = cls
class DataError(DatabaseError):
"""
An error caused by problems with the processed data.
Examples may be division by zero, numeric value out of range, etc.
"""
__module__ = "psycopg"
class OperationalError(DatabaseError):
"""
An error related to the database's operation.
These errors are not necessarily under the control of the programmer, e.g.
an unexpected disconnect occurs, the data source name is not found, a
transaction could not be processed, a memory allocation error occurred
during processing, etc.
"""
__module__ = "psycopg"
class IntegrityError(DatabaseError):
"""
An error caused when the relational integrity of the database is affected.
An example may be a foreign key check failed.
"""
__module__ = "psycopg"
class InternalError(DatabaseError):
"""
An error generated when the database encounters an internal error,
Examples could be the cursor is not valid anymore, the transaction is out
of sync, etc.
"""
__module__ = "psycopg"
class ProgrammingError(DatabaseError):
"""
Exception raised for programming errors
Examples may be table not found or already exists, syntax error in the SQL
statement, wrong number of parameters specified, etc.
"""
__module__ = "psycopg"
class NotSupportedError(DatabaseError):
"""
A method or database API was used which is not supported by the database.
"""
__module__ = "psycopg"
class ConnectionTimeout(OperationalError):
"""
Exception raised on timeout of the `~psycopg.Connection.connect()` method.
The error is raised if the ``connect_timeout`` is specified and a
connection is not obtained in useful time.
Subclass of `~psycopg.OperationalError`.
"""
class CancellationTimeout(OperationalError):
"""
Exception raised on timeout of connection's
`~psycopg.Connection.cancel_safe()` method.
Subclass of `~psycopg.OperationalError`.
"""
class _WaitTimeout(OperationalError):
"""
Exception raised by the wait functions when their timeout expires.
Internal exception: callers should handle it or convert it to a public one.
"""
class PipelineAborted(OperationalError):
"""
Raised when a operation fails because the current pipeline is in aborted state.
Subclass of `~psycopg.OperationalError`.
"""
class Diagnostic:
"""Details from a database error report."""
def __init__(self, info: ErrorInfo, encoding: str = "utf-8"):
self._info = info
self._encoding = encoding
@property
def severity(self) -> str | None:
return self._error_message(DiagnosticField.SEVERITY)
@property
def severity_nonlocalized(self) -> str | None:
return self._error_message(DiagnosticField.SEVERITY_NONLOCALIZED)
@property
def sqlstate(self) -> str | None:
return self._error_message(DiagnosticField.SQLSTATE)
@property
def message_primary(self) -> str | None:
return self._error_message(DiagnosticField.MESSAGE_PRIMARY)
@property
def message_detail(self) -> str | None:
return self._error_message(DiagnosticField.MESSAGE_DETAIL)
@property
def message_hint(self) -> str | None:
return self._error_message(DiagnosticField.MESSAGE_HINT)
@property
def statement_position(self) -> str | None:
return self._error_message(DiagnosticField.STATEMENT_POSITION)
@property
def internal_position(self) -> str | None:
return self._error_message(DiagnosticField.INTERNAL_POSITION)
@property
def internal_query(self) -> str | None:
return self._error_message(DiagnosticField.INTERNAL_QUERY)
@property
def context(self) -> str | None:
return self._error_message(DiagnosticField.CONTEXT)
@property
def schema_name(self) -> str | None:
return self._error_message(DiagnosticField.SCHEMA_NAME)
@property
def table_name(self) -> str | None:
return self._error_message(DiagnosticField.TABLE_NAME)
@property
def column_name(self) -> str | None:
return self._error_message(DiagnosticField.COLUMN_NAME)
@property
def datatype_name(self) -> str | None:
return self._error_message(DiagnosticField.DATATYPE_NAME)
@property
def constraint_name(self) -> str | None:
return self._error_message(DiagnosticField.CONSTRAINT_NAME)
@property
def source_file(self) -> str | None:
return self._error_message(DiagnosticField.SOURCE_FILE)
@property
def source_line(self) -> str | None:
return self._error_message(DiagnosticField.SOURCE_LINE)
@property
def source_function(self) -> str | None:
return self._error_message(DiagnosticField.SOURCE_FUNCTION)
def _error_message(self, field: DiagnosticField) -> str | None:
if self._info:
if isinstance(self._info, dict):
val = self._info.get(field)
else:
val = self._info.error_field(field)
if val is not None:
return val.decode(self._encoding, "replace")
return None
def __reduce__(self) -> str | tuple[Any, ...]:
res = super().__reduce__()
if isinstance(res, tuple) and len(res) >= 3:
res[2]["_info"] = _info_to_dict(self._info)
return res
def _info_to_dict(info: ErrorInfo) -> ErrorInfo:
"""
Convert a PGresult to a dictionary to make the info picklable.
"""
# PGresult is a protocol, can't use isinstance
if _is_pgresult(info):
return {v: info.error_field(v) for v in DiagnosticField}
else:
return info
def lookup(sqlstate: str) -> type[Error]:
"""Lookup an error code or `constant name`__ and return its exception class.
Raise `!KeyError` if the code is not found.
.. __: https://www.postgresql.org/docs/current/errcodes-appendix.html
#ERRCODES-TABLE
"""
return _sqlcodes[sqlstate.upper()]
def error_from_result(result: PGresult, encoding: str = "utf-8") -> Error:
state = result.error_field(DiagnosticField.SQLSTATE) or b""
cls = _class_for_state(state.decode("utf-8", "replace"))
return cls(result.get_error_message(encoding), info=result, encoding=encoding)
def _is_pgresult(info: ErrorInfo) -> TypeGuard[PGresult]:
"""Return True if an ErrorInfo is a PGresult instance."""
# PGresult is a protocol, can't use isinstance
return hasattr(info, "error_field")
def _class_for_state(sqlstate: str) -> type[Error]:
try:
return lookup(sqlstate)
except KeyError:
return get_base_exception(sqlstate)
def get_base_exception(sqlstate: str) -> type[Error]:
return (
_base_exc_map.get(sqlstate[:2])
or _base_exc_map.get(sqlstate[:1])
or DatabaseError
)
_base_exc_map = {
"08": OperationalError, # Connection Exception
"0A": NotSupportedError, # Feature Not Supported
"10": ProgrammingError, # XQuery Error
"20": ProgrammingError, # Case Not Foud
"21": ProgrammingError, # Cardinality Violation
"22": DataError, # Data Exception
"23": IntegrityError, # Integrity Constraint Violation
"24": InternalError, # Invalid Cursor State
"25": InternalError, # Invalid Transaction State
"26": ProgrammingError, # Invalid SQL Statement Name *
"27": OperationalError, # Triggered Data Change Violation
"28": OperationalError, # Invalid Authorization Specification
"2B": InternalError, # Dependent Privilege Descriptors Still Exist
"2D": InternalError, # Invalid Transaction Termination
"2F": OperationalError, # SQL Routine Exception *
"34": ProgrammingError, # Invalid Cursor Name *
"38": OperationalError, # External Routine Exception *
"39": OperationalError, # External Routine Invocation Exception *
"3B": OperationalError, # Savepoint Exception *
"3D": ProgrammingError, # Invalid Catalog Name
"3F": ProgrammingError, # Invalid Schema Name
"40": OperationalError, # Transaction Rollback
"42": ProgrammingError, # Syntax Error or Access Rule Violation
"44": ProgrammingError, # WITH CHECK OPTION Violation
"53": OperationalError, # Insufficient Resources
"54": OperationalError, # Program Limit Exceeded
"55": OperationalError, # Object Not In Prerequisite State
"57": OperationalError, # Operator Intervention
"58": OperationalError, # System Error (errors external to PostgreSQL itself)
"F": OperationalError, # Configuration File Error
"H": OperationalError, # Foreign Data Wrapper Error (SQL/MED)
"P": ProgrammingError, # PL/pgSQL Error
"X": InternalError, # Internal Error
}
# Error classes generated by tools/update_errors.py
# fmt: off
# autogenerated: start
# Class 02 - No Data (this is also a warning class per the SQL standard)
class NoData(DatabaseError,
code='02000', name='NO_DATA'):
pass
class NoAdditionalDynamicResultSetsReturned(DatabaseError,
code='02001', name='NO_ADDITIONAL_DYNAMIC_RESULT_SETS_RETURNED'):
pass
# Class 03 - SQL Statement Not Yet Complete
class SqlStatementNotYetComplete(DatabaseError,
code='03000', name='SQL_STATEMENT_NOT_YET_COMPLETE'):
pass
# Class 08 - Connection Exception
class ConnectionException(OperationalError,
code='08000', name='CONNECTION_EXCEPTION'):
pass
class SqlclientUnableToEstablishSqlconnection(OperationalError,
code='08001', name='SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION'):
pass
class ConnectionDoesNotExist(OperationalError,
code='08003', name='CONNECTION_DOES_NOT_EXIST'):
pass
class SqlserverRejectedEstablishmentOfSqlconnection(OperationalError,
code='08004', name='SQLSERVER_REJECTED_ESTABLISHMENT_OF_SQLCONNECTION'):
pass
class ConnectionFailure(OperationalError,
code='08006', name='CONNECTION_FAILURE'):
pass
class TransactionResolutionUnknown(OperationalError,
code='08007', name='TRANSACTION_RESOLUTION_UNKNOWN'):
pass
class ProtocolViolation(OperationalError,
code='08P01', name='PROTOCOL_VIOLATION'):
pass
# Class 09 - Triggered Action Exception
class TriggeredActionException(DatabaseError,
code='09000', name='TRIGGERED_ACTION_EXCEPTION'):
pass
# Class 0A - Feature Not Supported
class FeatureNotSupported(NotSupportedError,
code='0A000', name='FEATURE_NOT_SUPPORTED'):
pass
# Class 0B - Invalid Transaction Initiation
class InvalidTransactionInitiation(DatabaseError,
code='0B000', name='INVALID_TRANSACTION_INITIATION'):
pass
# Class 0F - Locator Exception
class LocatorException(DatabaseError,
code='0F000', name='LOCATOR_EXCEPTION'):
pass
class InvalidLocatorSpecification(DatabaseError,
code='0F001', name='INVALID_LOCATOR_SPECIFICATION'):
pass
# Class 0L - Invalid Grantor
class InvalidGrantor(DatabaseError,
code='0L000', name='INVALID_GRANTOR'):
pass
class InvalidGrantOperation(DatabaseError,
code='0LP01', name='INVALID_GRANT_OPERATION'):
pass
# Class 0P - Invalid Role Specification
class InvalidRoleSpecification(DatabaseError,
code='0P000', name='INVALID_ROLE_SPECIFICATION'):
pass
# Class 0Z - Diagnostics Exception
class DiagnosticsException(DatabaseError,
code='0Z000', name='DIAGNOSTICS_EXCEPTION'):
pass
class StackedDiagnosticsAccessedWithoutActiveHandler(DatabaseError,
code='0Z002', name='STACKED_DIAGNOSTICS_ACCESSED_WITHOUT_ACTIVE_HANDLER'):
pass
# Class 10 - XQuery Error
class InvalidArgumentForXquery(ProgrammingError,
code='10608', name='INVALID_ARGUMENT_FOR_XQUERY'):
pass
# Class 20 - Case Not Found
class CaseNotFound(ProgrammingError,
code='20000', name='CASE_NOT_FOUND'):
pass
# Class 21 - Cardinality Violation
class CardinalityViolation(ProgrammingError,
code='21000', name='CARDINALITY_VIOLATION'):
pass
# Class 22 - Data Exception
class DataException(DataError,
code='22000', name='DATA_EXCEPTION'):
pass
class StringDataRightTruncation(DataError,
code='22001', name='STRING_DATA_RIGHT_TRUNCATION'):
pass
class NullValueNoIndicatorParameter(DataError,
code='22002', name='NULL_VALUE_NO_INDICATOR_PARAMETER'):
pass
class NumericValueOutOfRange(DataError,
code='22003', name='NUMERIC_VALUE_OUT_OF_RANGE'):
pass
class NullValueNotAllowed(DataError,
code='22004', name='NULL_VALUE_NOT_ALLOWED'):
pass
class ErrorInAssignment(DataError,
code='22005', name='ERROR_IN_ASSIGNMENT'):
pass
class InvalidDatetimeFormat(DataError,
code='22007', name='INVALID_DATETIME_FORMAT'):
pass
class DatetimeFieldOverflow(DataError,
code='22008', name='DATETIME_FIELD_OVERFLOW'):
pass
class InvalidTimeZoneDisplacementValue(DataError,
code='22009', name='INVALID_TIME_ZONE_DISPLACEMENT_VALUE'):
pass
class EscapeCharacterConflict(DataError,
code='2200B', name='ESCAPE_CHARACTER_CONFLICT'):
pass
class InvalidUseOfEscapeCharacter(DataError,
code='2200C', name='INVALID_USE_OF_ESCAPE_CHARACTER'):
pass
class InvalidEscapeOctet(DataError,
code='2200D', name='INVALID_ESCAPE_OCTET'):
pass
class ZeroLengthCharacterString(DataError,
code='2200F', name='ZERO_LENGTH_CHARACTER_STRING'):
pass
class MostSpecificTypeMismatch(DataError,
code='2200G', name='MOST_SPECIFIC_TYPE_MISMATCH'):
pass
class SequenceGeneratorLimitExceeded(DataError,
code='2200H', name='SEQUENCE_GENERATOR_LIMIT_EXCEEDED'):
pass
class NotAnXmlDocument(DataError,
code='2200L', name='NOT_AN_XML_DOCUMENT'):
pass
class InvalidXmlDocument(DataError,
code='2200M', name='INVALID_XML_DOCUMENT'):
pass
class InvalidXmlContent(DataError,
code='2200N', name='INVALID_XML_CONTENT'):
pass
class InvalidXmlComment(DataError,
code='2200S', name='INVALID_XML_COMMENT'):
pass
class InvalidXmlProcessingInstruction(DataError,
code='2200T', name='INVALID_XML_PROCESSING_INSTRUCTION'):
pass
class InvalidIndicatorParameterValue(DataError,
code='22010', name='INVALID_INDICATOR_PARAMETER_VALUE'):
pass
class SubstringError(DataError,
code='22011', name='SUBSTRING_ERROR'):
pass
class DivisionByZero(DataError,
code='22012', name='DIVISION_BY_ZERO'):
pass
class InvalidPrecedingOrFollowingSize(DataError,
code='22013', name='INVALID_PRECEDING_OR_FOLLOWING_SIZE'):
pass
class InvalidArgumentForNtileFunction(DataError,
code='22014', name='INVALID_ARGUMENT_FOR_NTILE_FUNCTION'):
pass
class IntervalFieldOverflow(DataError,
code='22015', name='INTERVAL_FIELD_OVERFLOW'):
pass
class InvalidArgumentForNthValueFunction(DataError,
code='22016', name='INVALID_ARGUMENT_FOR_NTH_VALUE_FUNCTION'):
pass
class InvalidCharacterValueForCast(DataError,
code='22018', name='INVALID_CHARACTER_VALUE_FOR_CAST'):
pass
class InvalidEscapeCharacter(DataError,
code='22019', name='INVALID_ESCAPE_CHARACTER'):
pass
class InvalidRegularExpression(DataError,
code='2201B', name='INVALID_REGULAR_EXPRESSION'):
pass
class InvalidArgumentForLogarithm(DataError,
code='2201E', name='INVALID_ARGUMENT_FOR_LOGARITHM'):
pass
class InvalidArgumentForPowerFunction(DataError,
code='2201F', name='INVALID_ARGUMENT_FOR_POWER_FUNCTION'):
pass
class InvalidArgumentForWidthBucketFunction(DataError,
code='2201G', name='INVALID_ARGUMENT_FOR_WIDTH_BUCKET_FUNCTION'):
pass
class InvalidRowCountInLimitClause(DataError,
code='2201W', name='INVALID_ROW_COUNT_IN_LIMIT_CLAUSE'):
pass
class InvalidRowCountInResultOffsetClause(DataError,
code='2201X', name='INVALID_ROW_COUNT_IN_RESULT_OFFSET_CLAUSE'):
pass
class CharacterNotInRepertoire(DataError,
code='22021', name='CHARACTER_NOT_IN_REPERTOIRE'):
pass
class IndicatorOverflow(DataError,
code='22022', name='INDICATOR_OVERFLOW'):
pass
class InvalidParameterValue(DataError,
code='22023', name='INVALID_PARAMETER_VALUE'):
pass
class UnterminatedCString(DataError,
code='22024', name='UNTERMINATED_C_STRING'):
pass
class InvalidEscapeSequence(DataError,
code='22025', name='INVALID_ESCAPE_SEQUENCE'):
pass
class StringDataLengthMismatch(DataError,
code='22026', name='STRING_DATA_LENGTH_MISMATCH'):
pass
class TrimError(DataError,
code='22027', name='TRIM_ERROR'):
pass
class ArraySubscriptError(DataError,
code='2202E', name='ARRAY_SUBSCRIPT_ERROR'):
pass
class InvalidTablesampleRepeat(DataError,
code='2202G', name='INVALID_TABLESAMPLE_REPEAT'):
pass
class InvalidTablesampleArgument(DataError,
code='2202H', name='INVALID_TABLESAMPLE_ARGUMENT'):
pass
class DuplicateJsonObjectKeyValue(DataError,
code='22030', name='DUPLICATE_JSON_OBJECT_KEY_VALUE'):
pass
class InvalidArgumentForSqlJsonDatetimeFunction(DataError,
code='22031', name='INVALID_ARGUMENT_FOR_SQL_JSON_DATETIME_FUNCTION'):
pass
class InvalidJsonText(DataError,
code='22032', name='INVALID_JSON_TEXT'):
pass
class InvalidSqlJsonSubscript(DataError,
code='22033', name='INVALID_SQL_JSON_SUBSCRIPT'):
pass
class MoreThanOneSqlJsonItem(DataError,
code='22034', name='MORE_THAN_ONE_SQL_JSON_ITEM'):
pass
class NoSqlJsonItem(DataError,
code='22035', name='NO_SQL_JSON_ITEM'):
pass
class NonNumericSqlJsonItem(DataError,
code='22036', name='NON_NUMERIC_SQL_JSON_ITEM'):
pass
class NonUniqueKeysInAJsonObject(DataError,
code='22037', name='NON_UNIQUE_KEYS_IN_A_JSON_OBJECT'):
pass
class SingletonSqlJsonItemRequired(DataError,
code='22038', name='SINGLETON_SQL_JSON_ITEM_REQUIRED'):
pass
class SqlJsonArrayNotFound(DataError,
code='22039', name='SQL_JSON_ARRAY_NOT_FOUND'):
pass
class SqlJsonMemberNotFound(DataError,
code='2203A', name='SQL_JSON_MEMBER_NOT_FOUND'):
pass
class SqlJsonNumberNotFound(DataError,
code='2203B', name='SQL_JSON_NUMBER_NOT_FOUND'):
pass
class SqlJsonObjectNotFound(DataError,
code='2203C', name='SQL_JSON_OBJECT_NOT_FOUND'):
pass
class TooManyJsonArrayElements(DataError,
code='2203D', name='TOO_MANY_JSON_ARRAY_ELEMENTS'):
pass
class TooManyJsonObjectMembers(DataError,