gel_db_protocol/
protocol.rs

1use gel_protogen::prelude::*;
2
3pub use gel_protogen::prelude;
4
5message_group!(
6    EdgeDBBackend: Message = [
7        AuthenticationOk,
8        AuthenticationRequiredSASLMessage,
9        AuthenticationSASLContinue,
10        AuthenticationSASLFinal,
11        ServerKeyData,
12        ParameterStatus,
13        ServerHandshake,
14        ReadyForCommand,
15        RestoreReady,
16        CommandComplete,
17        CommandDataDescription,
18        StateDataDescription,
19        Data,
20        DumpHeader,
21        DumpBlock,
22        ErrorResponse,
23        LogMessage
24    ]
25);
26
27message_group!(
28    EdgeDBFrontend: Message = [
29        ClientHandshake,
30        AuthenticationSASLInitialResponse,
31        AuthenticationSASLResponse,
32        Parse,
33        Execute,
34        Sync,
35        Terminate,
36        Dump,
37        Restore,
38        RestoreBlock,
39        RestoreEof
40    ]
41);
42
43protocol!(
44
45/// A generic base for all EdgeDB mtype/mlen-style messages.
46struct Message<'a> {
47    /// Identifies the message.
48    mtype: u8,
49    /// Length of message contents in bytes, including self.
50    mlen: len,
51    /// Message contents.
52    data: Rest<'a>,
53}
54
55/// The `ErrorResponse` struct represents an error message sent from the server.
56struct ErrorResponse<'a>: Message {
57    /// Identifies the message as an error response.
58    mtype: u8 = 'E',
59    /// Length of message contents in bytes, including self.
60    mlen: len,
61    /// Message severity.
62    severity: u8,
63    /// Message code.
64    error_code: u32,
65    /// Error message.
66    message: LString<'a>,
67    /// Error attributes.
68    attributes: Array<'a, i16, KeyValue<'a>>,
69}
70
71/// The `LogMessage` struct represents a log message sent from the server.
72struct LogMessage<'a>: Message {
73    /// Identifies the message as a log message.
74    mtype: u8 = 'L',
75    /// Length of message contents in bytes, including self.
76    mlen: len,
77    /// Message severity.
78    severity: u8,
79    /// Message code.
80    code: i32,
81    /// Message text.
82    text: LString<'a>,
83    /// Message annotations.
84    annotations: Array<'a, i16, Annotation<'a>>,
85}
86
87/// The `ReadyForCommand` struct represents a message indicating the server is ready for a new command.
88struct ReadyForCommand<'a>: Message {
89    /// Identifies the message as ready for command.
90    mtype: u8 = 'Z',
91    /// Length of message contents in bytes, including self.
92    mlen: len,
93    /// Message annotations.
94    annotations: Array<'a, i16, Annotation<'a>>,
95    /// Transaction state.
96    transaction_state: TransactionState,
97}
98
99/// The `RestoreReady` struct represents a message indicating the server is ready for restore.
100struct RestoreReady<'a>: Message {
101    /// Identifies the message as restore ready.
102    mtype: u8 = '+',
103    /// Length of message contents in bytes, including self.
104    mlen: len,
105    /// Message headers.
106    headers: Array<'a, i16, KeyValue<'a>>,
107    /// Number of parallel jobs for restore.
108    jobs: u16,
109}
110
111/// The `CommandComplete` struct represents a message indicating a command has completed.
112struct CommandComplete<'a>: Message {
113    /// Identifies the message as command complete.
114    mtype: u8 = 'C',
115    /// Length of message contents in bytes, including self.
116    mlen: len,
117    /// Message annotations.
118    annotations: Array<'a, i16, Annotation<'a>>,
119    /// A bit mask of allowed capabilities.
120    capabilities: u64,
121    /// Command status.
122    status: LString<'a>,
123    /// State data descriptor ID.
124    state_typedesc_id: Uuid,
125    /// Encoded state data.
126    state_data: Array<'a, u32, u8>,
127}
128
129/// The `CommandDataDescription` struct represents a description of command data.
130struct CommandDataDescription<'a>: Message {
131    /// Identifies the message as command data description.
132    mtype: u8 = 'T',
133    /// Length of message contents in bytes, including self.
134    mlen: len,
135    /// Message annotations.
136    annotations: Array<'a, i16, Annotation<'a>>,
137    /// A bit mask of allowed capabilities.
138    capabilities: u64,
139    /// Actual result cardinality.
140    result_cardinality: u8,
141    /// Argument data descriptor ID.
142    input_typedesc_id: Uuid,
143    /// Argument data descriptor.
144    input_typedesc: Array<'a, u32, u8>,
145    /// Output data descriptor ID.
146    output_typedesc_id: Uuid,
147    /// Output data descriptor.
148    output_typedesc: Array<'a, u32, u8>,
149}
150
151/// The `StateDataDescription` struct represents a description of state data.
152struct StateDataDescription<'a>: Message {
153    /// Identifies the message as state data description.
154    mtype: u8 = 's',
155    /// Length of message contents in bytes, including self.
156    mlen: len,
157    /// Updated state data descriptor ID.
158    typedesc_id: Uuid,
159    /// State data descriptor.
160    typedesc: Array<'a, u32, u8>,
161}
162
163/// The `Data` struct represents a data message.
164struct Data<'a>: Message {
165    /// Identifies the message as data.
166    mtype: u8 = 'D',
167    /// Length of message contents in bytes, including self.
168    mlen: len,
169    /// Encoded output data array.
170    data: Array<'a, i16, DataElement<'a>>,
171}
172
173/// The `DumpHeader` struct represents a dump header message.
174struct DumpHeader<'a>: Message {
175    /// Identifies the message as dump header.
176    mtype: u8 = '@',
177    /// Length of message contents in bytes, including self.
178    mlen: len,
179    /// Dump attributes.
180    attributes: Array<'a, i16, KeyValue<'a>>,
181    /// Major version of EdgeDB.
182    major_ver: i16,
183    /// Minor version of EdgeDB.
184    minor_ver: i16,
185    /// Schema.
186    schema_ddl: LString<'a>,
187    /// Type identifiers.
188    types: Array<'a, i32, DumpTypeInfo<'a>>,
189    /// Object descriptors.
190    descriptors: Array<'a, i32, DumpObjectDesc<'a>>,
191}
192
193/// The `DumpBlock` struct represents a dump block message.
194struct DumpBlock<'a>: Message {
195    /// Identifies the message as dump block.
196    mtype: u8 = '=',
197    /// Length of message contents in bytes, including self.
198    mlen: len,
199    /// Dump attributes.
200    attributes: Array<'a, i16, KeyValue<'a>>,
201}
202
203/// The `ServerKeyData` struct represents server key data.
204struct ServerKeyData<'a>: Message {
205    /// Identifies the message as server key data.
206    mtype: u8 = 'K',
207    /// Length of message contents in bytes, including self.
208    mlen: len,
209    /// Key data.
210    data: [u8; 32],
211}
212
213/// The `ParameterStatus` struct represents a parameter status message.
214struct ParameterStatus<'a>: Message {
215    /// Identifies the message as parameter status.
216    mtype: u8 = 'S',
217    /// Length of message contents in bytes, including self.
218    mlen: len,
219    /// Parameter name.
220    name: Array<'a, u32, u8>,
221    /// Parameter value.
222    value: Array<'a, u32, u8>,
223}
224
225/// The `ServerHandshake` struct represents a server handshake message.
226struct ServerHandshake<'a>: Message {
227    /// Identifies the message as server handshake.
228    mtype: u8 = 'v',
229    /// Length of message contents in bytes, including self.
230    mlen: len,
231    /// Maximum supported or client-requested protocol major version.
232    major_ver: u16,
233    /// Maximum supported or client-requested protocol minor version.
234    minor_ver: u16,
235    /// Supported protocol extensions.
236    extensions: Array<'a, i16, ProtocolExtension<'a>>,
237}
238
239/// The `AuthenticationRequired` struct represents an authentication message.
240struct Authentication<'a>: Message {
241    /// Identifies the message as authentication OK.
242    mtype: u8 = 'R',
243    /// Length of message contents in bytes, including self.
244    mlen: len,
245    /// The type of authentication message.
246    auth_status: i32,
247    /// The authentication data.
248    data: Rest<'a>,
249}
250
251/// The `AuthenticationOk` struct represents a successful authentication message.
252struct AuthenticationOk<'a>: Message {
253    /// Identifies the message as authentication OK.
254    mtype: u8 = 'R',
255    /// Length of message contents in bytes, including self.
256    mlen: len,
257    /// Specifies that this message contains a successful authentication indicator.
258    auth_status: i32 = 0x0,
259}
260
261/// The `AuthenticationRequiredSASLMessage` struct represents a SASL authentication request.
262struct AuthenticationRequiredSASLMessage<'a>: Message {
263    /// Identifies the message as authentication required SASL.
264    mtype: u8 = 'R',
265    /// Length of message contents in bytes, including self.
266    mlen: len,
267    /// Specifies that this message contains a SASL authentication request.
268    auth_status: i32 = 0x0A,
269    /// A list of supported SASL authentication methods.
270    methods: Array<'a, i32, LString<'a>>,
271}
272
273/// The `AuthenticationSASLContinue` struct represents a SASL challenge.
274struct AuthenticationSASLContinue<'a>: Message {
275    /// Identifies the message as authentication SASL continue.
276    mtype: u8 = 'R',
277    /// Length of message contents in bytes, including self.
278    mlen: len,
279    /// Specifies that this message contains a SASL challenge.
280    auth_status: i32 = 0x0B,
281    /// Mechanism-specific SASL data.
282    sasl_data: Array<'a, u32, u8>,
283}
284
285/// The `AuthenticationSASLFinal` struct represents the completion of SASL authentication.
286struct AuthenticationSASLFinal<'a>: Message {
287    /// Identifies the message as authentication SASL final.
288    mtype: u8 = 'R',
289    /// Length of message contents in bytes, including self.
290    mlen: len,
291    /// Specifies that SASL authentication has completed.
292    auth_status: i32 = 0x0C,
293    /// SASL data.
294    sasl_data: Array<'a, u32, u8>,
295}
296
297/// The `Dump` struct represents a dump message from the client.
298struct Dump<'a>: Message {
299    /// Identifies the message as dump.
300    mtype: u8 = '>',
301    /// Length of message contents in bytes, including self.
302    mlen: len,
303    /// Message annotations.
304    annotations: Array<'a, i16, Annotation<'a>>,
305}
306
307/// The `Dump2` struct represents a dump message from the client.
308struct Dump2<'a>: Message {
309    /// Identifies the message as dump.
310    mtype: u8 = '>',
311    /// Length of message contents in bytes, including self.
312    mlen: len,
313    /// Message headers.
314    headers: Array<'a, i16, KeyValue<'a>>,
315}
316
317/// The `Dump3` struct represents a dump message from the client.
318struct Dump3<'a>: Message {
319    /// Identifies the message as dump.
320    mtype: u8 = '>',
321    /// Length of message contents in bytes, including self.
322    mlen: len,
323    /// Message annotations.
324    annotations: Array<'a, i16, Annotation<'a>>,
325    /// A bit mask of dump options.
326    flags: u64,
327}
328
329/// The `Sync` struct represents a synchronization message from the client.
330struct Sync<'a>: Message {
331    /// Identifies the message as sync.
332    mtype: u8 = 'S',
333    /// Length of message contents in bytes, including self.
334    mlen: len,
335}
336
337/// The `Restore` struct represents a restore message from the client.
338struct Restore<'a>: Message {
339    /// Identifies the message as restore.
340    mtype: u8 = '<',
341    /// Length of message contents in bytes, including self.
342    mlen: len,
343    /// Restore headers.
344    headers: Array<'a, i16, KeyValue<'a>>,
345    /// Number of parallel jobs for restore.
346    jobs: u16,
347    /// Original DumpHeader packet data excluding mtype and message_length.
348    data: Rest<'a>,
349}
350
351/// The `RestoreBlock` struct represents a restore block message from the client.
352struct RestoreBlock<'a>: Message {
353    /// Identifies the message as restore block.
354    mtype: u8 = '=',
355    /// Length of message contents in bytes, including self.
356    mlen: len,
357    /// Original DumpBlock packet data excluding mtype and message_length.
358    block_data: Array<'a, u32, u8>,
359}
360
361/// The `RestoreEof` struct represents the end of restore message from the client.
362struct RestoreEof<'a>: Message {
363    /// Identifies the message as restore EOF.
364    mtype: u8 = '.',
365    /// Length of message contents in bytes, including self.
366    mlen: len,
367}
368
369/// The `Parse` struct represents a parse message from the client.
370struct Parse2<'a>: Message {
371    /// Identifies the message as parse.
372    mtype: u8 = 'P',
373    /// Length of message contents in bytes, including self.
374    mlen: len,
375    /// Message annotations.
376    annotations: Array<'a, i16, Annotation<'a>>,
377    /// A bit mask of allowed capabilities.
378    allowed_capabilities: u64,
379    /// A bit mask of query options.
380    compilation_flags: u64,
381    /// Implicit LIMIT clause on returned sets.
382    implicit_limit: u64,
383    /// Data output format.
384    output_format: IoFormat,
385    /// Expected result cardinality.
386    expected_cardinality: u8,
387    /// Command text.
388    command_text: LString<'a>,
389    /// State data descriptor ID.
390    state_typedesc_id: Uuid,
391    /// Encoded state data.
392    state_data: Array<'a, u32, u8>,
393}
394
395/// The `Parse` struct represents a parse message from the client.
396struct Parse<'a>: Message {
397    /// Identifies the message as parse.
398    mtype: u8 = 'P',
399    /// Length of message contents in bytes, including self.
400    mlen: len,
401    /// Message annotations.
402    annotations: Array<'a, i16, Annotation<'a>>,
403    /// A bit mask of allowed capabilities.
404    allowed_capabilities: u64,
405    /// A bit mask of query options.
406    compilation_flags: u64,
407    /// Implicit LIMIT clause on returned sets.
408    implicit_limit: u64,
409    /// Input language.
410    input_language: InputLanguage,
411    /// Data output format.
412    output_format: IoFormat,
413    /// Expected result cardinality.
414    expected_cardinality: u8,
415    /// Command text.
416    command_text: LString<'a>,
417    /// State data descriptor ID.
418    state_typedesc_id: Uuid,
419    /// Encoded state data.
420    state_data: Array<'a, u32, u8>,
421}
422
423/// The `Execute` struct represents an execute message from the client.
424struct Execute<'a>: Message {
425    /// Identifies the message as execute.
426    mtype: u8 = 'O',
427    /// Length of message contents in bytes, including self.
428    mlen: len,
429    /// Message annotations.
430    annotations: Array<'a, i16, Annotation<'a>>,
431    /// A bit mask of allowed capabilities.
432    allowed_capabilities: u64,
433    /// A bit mask of query options.
434    compilation_flags: u64,
435    /// Implicit LIMIT clause on returned sets.
436    implicit_limit: u64,
437    /// Input language.
438    input_language: InputLanguage,
439    /// Data output format.
440    output_format: IoFormat,
441    /// Expected result cardinality.
442    expected_cardinality: u8,
443    /// Command text.
444    command_text: LString<'a>,
445    /// State data descriptor ID.
446    state_typedesc_id: Uuid,
447    /// Encoded state data.
448    state_data: Array<'a, u32, u8>,
449    /// Argument data descriptor ID.
450    input_typedesc_id: Uuid,
451    /// Output data descriptor ID.
452    output_typedesc_id: Uuid,
453    /// Encoded argument data.
454    arguments: Array<'a, u32, u8>,
455}
456
457/// The `ClientHandshake` struct represents a client handshake message.
458struct ClientHandshake<'a>: Message {
459    /// Identifies the message as client handshake.
460    mtype: u8 = 'V',
461    /// Length of message contents in bytes, including self.
462    mlen: len,
463    /// Requested protocol major version.
464    major_ver: u16,
465    /// Requested protocol minor version.
466    minor_ver: u16,
467    /// Connection parameters.
468    params: Array<'a, i16, ConnectionParam<'a>>,
469    /// Requested protocol extensions.
470    extensions: Array<'a, i16, ProtocolExtension<'a>>,
471}
472
473/// The `Terminate` struct represents a termination message from the client.
474struct Terminate<'a>: Message {
475    /// Identifies the message as terminate.
476    mtype: u8 = 'X',
477    /// Length of message contents in bytes, including self.
478    mlen: len,
479}
480
481/// The `AuthenticationSASLInitialResponse` struct represents the initial SASL response from the client.
482struct AuthenticationSASLInitialResponse<'a>: Message {
483    /// Identifies the message as authentication SASL initial response.
484    mtype: u8 = 'p',
485    /// Length of message contents in bytes, including self.
486    mlen: len,
487    /// Name of the SASL authentication mechanism that the client selected.
488    method: LString<'a>,
489    /// Mechanism-specific "Initial Response" data.
490    sasl_data: Array<'a, u32, u8>,
491}
492
493/// The `AuthenticationSASLResponse` struct represents a SASL response from the client.
494struct AuthenticationSASLResponse<'a>: Message {
495    /// Identifies the message as authentication SASL response.
496    mtype: u8 = 'r',
497    /// Length of message contents in bytes, including self.
498    mlen: len,
499    /// Mechanism-specific response data.
500    sasl_data: Array<'a, u32, u8>,
501}
502
503/// The `KeyValue` struct represents a key-value pair.
504struct KeyValue<'a> {
505    /// Key code (specific to the type of the Message).
506    code: u16,
507    /// Value data.
508    value: Array<'a, u32, u8>,
509}
510
511/// The `Annotation` struct represents an annotation.
512struct Annotation<'a> {
513    /// Name of the annotation.
514    name: LString<'a>,
515    /// Value of the annotation (in JSON format).
516    value: LString<'a>,
517}
518
519/// The `DataElement` struct represents a data element.
520struct DataElement<'a> {
521    /// Encoded output data.
522    data: Array<'a, i32, u8>,
523}
524
525/// The `DumpTypeInfo` struct represents type information in a dump.
526struct DumpTypeInfo<'a> {
527    /// Type name.
528    type_name: LString<'a>,
529    /// Type class.
530    type_class: LString<'a>,
531    /// Type ID.
532    type_id: Uuid,
533}
534
535/// The `DumpObjectDesc` struct represents an object descriptor in a dump.
536struct DumpObjectDesc<'a> {
537    /// Object ID.
538    object_id: Uuid,
539    /// Description.
540    description: Array<'a, u32, u8>,
541    /// Dependencies.
542    dependencies: Array<'a, i16, Uuid>,
543}
544
545/// The `ProtocolExtension` struct represents a protocol extension.
546struct ProtocolExtension<'a> {
547    /// Extension name.
548    name: LString<'a>,
549    /// A set of extension annotations.
550    annotations: Array<'a, i16, Annotation<'a>>,
551}
552
553/// The `ConnectionParam` struct represents a connection parameter.
554struct ConnectionParam<'a> {
555    /// Parameter name.
556    name: LString<'a>,
557    /// Parameter value.
558    value: LString<'a>,
559}
560
561/// Legacy version of [`Execute`] without `input_language`.
562struct Execute2<'a>: Message {
563    /// Identifies the message as execute.
564    mtype: u8 = 'O',
565    /// Length of message contents in bytes, including self.
566    mlen: len,
567    /// Message annotations.
568    annotations: Array<'a, i16, Annotation<'a>>,
569    /// A bit mask of allowed capabilities.
570    allowed_capabilities: u64,
571    /// A bit mask of query options.
572    compilation_flags: u64,
573    /// Implicit LIMIT clause on returned sets.
574    implicit_limit: u64,
575    /// Data output format.
576    output_format: IoFormat,
577    /// Expected result cardinality.
578    expected_cardinality: u8,
579    /// Command text.
580    command_text: LString<'a>,
581    /// State data descriptor ID.
582    state_typedesc_id: Uuid,
583    /// Encoded state data.
584    state_data: Array<'a, u32, u8>,
585    /// Argument data descriptor ID.
586    input_typedesc_id: Uuid,
587    /// Output data descriptor ID.
588    output_typedesc_id: Uuid,
589    /// Encoded argument data.
590    arguments: Array<'a, u32, u8>,
591}
592
593#[repr(u8)]
594/// Data format.
595enum IoFormat {
596    Binary = 0x62,
597    Json = 0x6a,
598    JsonElements = 0x4a,
599    #[default]
600    None = 0x6e,
601}
602
603
604#[repr(u8)]
605/// Aspect for [`DescribeStatement0`].
606enum DescribeAspect {
607    #[default]
608    DataDescription = 0x54,
609}
610
611#[repr(u8)]
612/// Input language.
613enum InputLanguage {
614    #[default]
615    None = 0,
616    EdgeQL = 0x45,
617    SQL = 0x53,
618}
619
620#[repr(u8)]
621/// The state of the current transaction.
622enum TransactionState {
623    #[default]
624    NotInTransaction = 0x49,
625    InTransaction = 0x54,
626    InFailedTransaction = 0x45,
627}
628
629);
630
631#[derive(
632    Clone, Copy, PartialEq, Eq, derive_more::Debug, derive_more::Error, derive_more::Display,
633)]
634#[repr(u32)]
635pub enum EdbError {
636    InternalServerError = 0x_01_00_00_00,
637    UnsupportedFeatureError = 0x_02_00_00_00,
638    ProtocolError = 0x_03_00_00_00,
639    BinaryProtocolError = 0x_03_01_00_00,
640    UnsupportedProtocolVersionError = 0x_03_01_00_01,
641    TypeSpecNotFoundError = 0x_03_01_00_02,
642    UnexpectedMessageError = 0x_03_01_00_03,
643    InputDataError = 0x_03_02_00_00,
644    ParameterTypeMismatchError = 0x_03_02_01_00,
645    StateMismatchError = 0x_03_02_02_00,
646    ResultCardinalityMismatchError = 0x_03_03_00_00,
647    CapabilityError = 0x_03_04_00_00,
648    UnsupportedCapabilityError = 0x_03_04_01_00,
649    DisabledCapabilityError = 0x_03_04_02_00,
650    QueryError = 0x_04_00_00_00,
651    InvalidSyntaxError = 0x_04_01_00_00,
652    EdgeQLSyntaxError = 0x_04_01_01_00,
653    SchemaSyntaxError = 0x_04_01_02_00,
654    GraphQLSyntaxError = 0x_04_01_03_00,
655    InvalidTypeError = 0x_04_02_00_00,
656    InvalidTargetError = 0x_04_02_01_00,
657    InvalidLinkTargetError = 0x_04_02_01_01,
658    InvalidPropertyTargetError = 0x_04_02_01_02,
659    InvalidReferenceError = 0x_04_03_00_00,
660    UnknownModuleError = 0x_04_03_00_01,
661    UnknownLinkError = 0x_04_03_00_02,
662    UnknownPropertyError = 0x_04_03_00_03,
663    UnknownUserError = 0x_04_03_00_04,
664    UnknownDatabaseError = 0x_04_03_00_05,
665    UnknownParameterError = 0x_04_03_00_06,
666    SchemaError = 0x_04_04_00_00,
667    SchemaDefinitionError = 0x_04_05_00_00,
668    InvalidDefinitionError = 0x_04_05_01_00,
669    InvalidModuleDefinitionError = 0x_04_05_01_01,
670    InvalidLinkDefinitionError = 0x_04_05_01_02,
671    InvalidPropertyDefinitionError = 0x_04_05_01_03,
672    InvalidUserDefinitionError = 0x_04_05_01_04,
673    InvalidDatabaseDefinitionError = 0x_04_05_01_05,
674    InvalidOperatorDefinitionError = 0x_04_05_01_06,
675    InvalidAliasDefinitionError = 0x_04_05_01_07,
676    InvalidFunctionDefinitionError = 0x_04_05_01_08,
677    InvalidConstraintDefinitionError = 0x_04_05_01_09,
678    InvalidCastDefinitionError = 0x_04_05_01_0A,
679    DuplicateDefinitionError = 0x_04_05_02_00,
680    DuplicateModuleDefinitionError = 0x_04_05_02_01,
681    DuplicateLinkDefinitionError = 0x_04_05_02_02,
682    DuplicatePropertyDefinitionError = 0x_04_05_02_03,
683    DuplicateUserDefinitionError = 0x_04_05_02_04,
684    DuplicateDatabaseDefinitionError = 0x_04_05_02_05,
685    DuplicateOperatorDefinitionError = 0x_04_05_02_06,
686    DuplicateViewDefinitionError = 0x_04_05_02_07,
687    DuplicateFunctionDefinitionError = 0x_04_05_02_08,
688    DuplicateConstraintDefinitionError = 0x_04_05_02_09,
689    DuplicateCastDefinitionError = 0x_04_05_02_0A,
690    DuplicateMigrationError = 0x_04_05_02_0B,
691    SessionTimeoutError = 0x_04_06_00_00,
692    IdleSessionTimeoutError = 0x_04_06_01_00,
693    QueryTimeoutError = 0x_04_06_02_00,
694    TransactionTimeoutError = 0x_04_06_0A_00,
695    IdleTransactionTimeoutError = 0x_04_06_0A_01,
696    ExecutionError = 0x_05_00_00_00,
697    InvalidValueError = 0x_05_01_00_00,
698    DivisionByZeroError = 0x_05_01_00_01,
699    NumericOutOfRangeError = 0x_05_01_00_02,
700    AccessPolicyError = 0x_05_01_00_03,
701    QueryAssertionError = 0x_05_01_00_04,
702    IntegrityError = 0x_05_02_00_00,
703    ConstraintViolationError = 0x_05_02_00_01,
704    CardinalityViolationError = 0x_05_02_00_02,
705    MissingRequiredError = 0x_05_02_00_03,
706    TransactionError = 0x_05_03_00_00,
707    TransactionConflictError = 0x_05_03_01_00,
708    TransactionSerializationError = 0x_05_03_01_01,
709    TransactionDeadlockError = 0x_05_03_01_02,
710    WatchError = 0x_05_04_00_00,
711    ConfigurationError = 0x_06_00_00_00,
712    AccessError = 0x_07_00_00_00,
713    AuthenticationError = 0x_07_01_00_00,
714    AvailabilityError = 0x_08_00_00_00,
715    BackendUnavailableError = 0x_08_00_00_01,
716    ServerOfflineError = 0x_08_00_00_02,
717    UnknownTenantError = 0x_08_00_00_03,
718    ServerBlockedError = 0x_08_00_00_04,
719    BackendError = 0x_09_00_00_00,
720    UnsupportedBackendFeatureError = 0x_09_00_01_00,
721    LogMessage = 0x_F0_00_00_00_u32,
722    WarningMessage = 0x_F0_01_00_00_u32,
723    ClientError = 0x_FF_00_00_00_u32,
724    ClientConnectionError = 0x_FF_01_00_00_u32,
725    ClientConnectionFailedError = 0x_FF_01_01_00_u32,
726    ClientConnectionFailedTemporarilyError = 0x_FF_01_01_01_u32,
727    ClientConnectionTimeoutError = 0x_FF_01_02_00_u32,
728    ClientConnectionClosedError = 0x_FF_01_03_00_u32,
729    InterfaceError = 0x_FF_02_00_00_u32,
730    QueryArgumentError = 0x_FF_02_01_00_u32,
731    MissingArgumentError = 0x_FF_02_01_01_u32,
732    UnknownArgumentError = 0x_FF_02_01_02_u32,
733    InvalidArgumentError = 0x_FF_02_01_03_u32,
734    NoDataError = 0x_FF_03_00_00_u32,
735    InternalClientError = 0x_FF_04_00_00_u32,
736}