Skip to main content

icydb_diagnostic_code/
registry.rs

1//! Module: registry
2//!
3//! Responsibility: single public diagnostic-code registry.
4//! Does not own: diagnostic prose or runtime error construction.
5//! Boundary: generates numeric constants and reconstruction from one table.
6
7use crate::{
8    Diagnostic, DiagnosticCode, DiagnosticDetail, ErrorClass, ErrorCode, ErrorOrigin,
9    QueryErrorKind, QueryProjectionCode, QueryReadAdmissionCode, RuntimeBoundaryCode,
10    RuntimeErrorKind, SchemaDdlAdmissionCode, SchemaMigrationCode, SqlFeatureCode, SqlLoweringCode,
11    SqlSurfaceMismatchCode, SqlWriteBoundaryCode,
12};
13
14macro_rules! define_error_code_registry {
15    (
16        $(
17            $name:ident = $raw:literal => $diagnostic:ident
18            $(, detail($detail_variant:ident { $($detail_body:tt)* }))?;
19        )+
20    ) => {
21        impl ErrorCode {
22            $(
23                pub const $name: Self = Self($raw);
24            )+
25
26            /// Recover a known public error code from its raw wire value.
27            #[must_use]
28            pub const fn known(raw: u16) -> Option<Self> {
29                match raw {
30                    $(
31                        $raw => Some(Self::$name),
32                    )+
33                    _ => None,
34                }
35            }
36
37            /// Return whether this error code is in the public registry.
38            #[must_use]
39            pub const fn is_known(self) -> bool {
40                match Self::known(self.raw()) {
41                    Some(_) => true,
42                    None => false,
43                }
44            }
45
46            /// Collapse a rich diagnostic into one public leaf code.
47            #[must_use]
48            pub const fn from_parts(
49                code: DiagnosticCode,
50                detail: Option<DiagnosticDetail>,
51            ) -> Self {
52                match (code, detail) {
53                    $(
54                        $(
55                            (
56                                DiagnosticCode::$diagnostic,
57                                Some(DiagnosticDetail::$detail_variant { $($detail_body)* }),
58                            ) => {
59                                Self::$name
60                            }
61                        )?
62                    )+
63                    _ => code.error_code(),
64                }
65            }
66
67            /// Return the broad diagnostic reason represented by this public code.
68            #[must_use]
69            pub const fn diagnostic_code(self) -> DiagnosticCode {
70                match self.raw() {
71                    $(
72                        $raw => DiagnosticCode::$diagnostic,
73                    )+
74                    _ => DiagnosticCode::RuntimeInternal,
75                }
76            }
77
78            /// Return the diagnostic class represented by this public code.
79            #[must_use]
80            pub const fn class(self) -> ErrorClass {
81                self.diagnostic_code().class()
82            }
83
84            /// Reconstruct rich diagnostic detail for host-side rendering, when known.
85            #[must_use]
86            pub const fn diagnostic_detail(self) -> Option<DiagnosticDetail> {
87                match self.raw() {
88                    $(
89                        $(
90                            $raw => Some(DiagnosticDetail::$detail_variant {
91                                $($detail_body)*
92                            }),
93                        )?
94                    )+
95                    _ => None,
96                }
97            }
98
99            /// Reconstruct a rich diagnostic payload for host-side rendering.
100            #[must_use]
101            pub const fn diagnostic(self, origin: ErrorOrigin) -> Diagnostic {
102                Diagnostic::new(self.diagnostic_code(), origin, self.diagnostic_detail())
103            }
104        }
105
106        impl DiagnosticDetail {
107            /// Return the broad diagnostic reason required by this detail payload.
108            #[must_use]
109            pub const fn diagnostic_code(self) -> DiagnosticCode {
110                match self {
111                    $(
112                        $(
113                            Self::$detail_variant { $($detail_body)* } => {
114                                DiagnosticCode::$diagnostic
115                            }
116                        )?
117                    )+
118                }
119            }
120        }
121
122        #[cfg(test)]
123        pub(super) const ORDERED_ERROR_CODES: &[ErrorCode] = &[
124            $(
125                ErrorCode::$name,
126            )+
127        ];
128
129        #[cfg(test)]
130        pub(super) const DETAIL_ERROR_CODES: &[(ErrorCode, DiagnosticCode, DiagnosticDetail)] = &[
131            $(
132                $(
133                    (
134                        ErrorCode::$name,
135                        DiagnosticCode::$diagnostic,
136                        DiagnosticDetail::$detail_variant {
137                            $($detail_body)*
138                        },
139                    ),
140                )?
141            )+
142        ];
143    };
144}
145
146// This table is the public numeric registry. Raw values are wire-significant;
147// keep them contiguous unless a gap is represented by an explicit reservation.
148define_error_code_registry! {
149    QUERY_VALIDATE = 1 => QueryValidate,
150        detail(QueryKind { kind: QueryErrorKind::Validate });
151    QUERY_INTENT = 2 => QueryIntent,
152        detail(QueryKind { kind: QueryErrorKind::Intent });
153    QUERY_PLAN = 3 => QueryPlan,
154        detail(QueryKind { kind: QueryErrorKind::Plan });
155    QUERY_UNORDERED_PAGINATION = 4 => QueryUnorderedPagination,
156        detail(QueryKind { kind: QueryErrorKind::UnorderedPagination });
157    QUERY_INVALID_CONTINUATION_CURSOR = 5 => QueryInvalidContinuationCursor,
158        detail(QueryKind { kind: QueryErrorKind::InvalidContinuationCursor });
159    QUERY_NOT_FOUND = 6 => QueryNotFound,
160        detail(QueryKind { kind: QueryErrorKind::NotFound });
161    QUERY_NOT_UNIQUE = 7 => QueryNotUnique,
162        detail(QueryKind { kind: QueryErrorKind::NotUnique });
163    QUERY_NUMERIC_OVERFLOW = 8 => QueryNumericOverflow;
164    QUERY_NUMERIC_NOT_REPRESENTABLE = 9 => QueryNumericNotRepresentable;
165    QUERY_UNKNOWN_AGGREGATE_TARGET_FIELD = 10 => QueryUnknownAggregateTargetField;
166    QUERY_UNSUPPORTED_SQL_FEATURE = 11 => QueryUnsupportedSqlFeature;
167    QUERY_SQL_SURFACE_MISMATCH = 12 => QuerySqlSurfaceMismatch;
168    SCHEMA_DDL_ADMISSION = 13 => SchemaDdlAdmission;
169    STORE_NOT_FOUND = 14 => StoreNotFound;
170    STORE_CORRUPTION = 15 => StoreCorruption;
171    STORE_INVARIANT_VIOLATION = 16 => StoreInvariantViolation;
172    RUNTIME_CORRUPTION = 17 => RuntimeCorruption,
173        detail(RuntimeKind { kind: RuntimeErrorKind::Corruption });
174    RUNTIME_INCOMPATIBLE_PERSISTED_FORMAT = 18 => RuntimeIncompatiblePersistedFormat,
175        detail(RuntimeKind { kind: RuntimeErrorKind::IncompatiblePersistedFormat });
176    RUNTIME_INVARIANT_VIOLATION = 19 => RuntimeInvariantViolation,
177        detail(RuntimeKind { kind: RuntimeErrorKind::InvariantViolation });
178    RUNTIME_CONFLICT = 20 => RuntimeConflict,
179        detail(RuntimeKind { kind: RuntimeErrorKind::Conflict });
180    RUNTIME_NOT_FOUND = 21 => RuntimeNotFound,
181        detail(RuntimeKind { kind: RuntimeErrorKind::NotFound });
182    RUNTIME_UNSUPPORTED = 22 => RuntimeUnsupported,
183        detail(RuntimeKind { kind: RuntimeErrorKind::Unsupported });
184    RUNTIME_INTERNAL = 23 => RuntimeInternal,
185        detail(RuntimeKind { kind: RuntimeErrorKind::Internal });
186
187    RUNTIME_BOUNDARY_SQL_SURFACE_CONTROLLER_REQUIRED = 24 => RuntimeUnsupported,
188        detail(RuntimeBoundary { boundary: RuntimeBoundaryCode::SqlSurfaceControllerRequired });
189    RUNTIME_BOUNDARY_SCHEMA_SURFACE_CONTROLLER_REQUIRED = 25 => RuntimeUnsupported,
190        detail(RuntimeBoundary { boundary: RuntimeBoundaryCode::SchemaSurfaceControllerRequired });
191    RUNTIME_BOUNDARY_SQL_QUERY_NO_CONFIGURED_ENTITIES = 26 => RuntimeUnsupported,
192        detail(RuntimeBoundary { boundary: RuntimeBoundaryCode::SqlQueryNoConfiguredEntities });
193    RUNTIME_BOUNDARY_SQL_QUERY_ENTITY_NOT_FOUND = 27 => RuntimeNotFound,
194        detail(RuntimeBoundary { boundary: RuntimeBoundaryCode::SqlQueryEntityNotFound });
195    RUNTIME_BOUNDARY_SQL_DDL_TARGET_REQUIRED = 28 => RuntimeUnsupported,
196        detail(RuntimeBoundary { boundary: RuntimeBoundaryCode::SqlDdlTargetRequired });
197    RUNTIME_BOUNDARY_SQL_DDL_ENTITY_NOT_CONFIGURED = 29 => RuntimeUnsupported,
198        detail(RuntimeBoundary { boundary: RuntimeBoundaryCode::SqlDdlEntityNotConfigured });
199    SQL_FEATURE_AGGREGATE_FILTER_CLAUSE = 30 => QueryUnsupportedSqlFeature,
200        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::AggregateFilterClause });
201    SQL_FEATURE_ALTER_STATEMENT_BEYOND_ALTER_TABLE = 31 => QueryUnsupportedSqlFeature,
202        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::AlterStatementBeyondAlterTable });
203    SQL_FEATURE_ALTER_TABLE_ADD_COLUMN_DUPLICATE_DEFAULT = 32 => QueryUnsupportedSqlFeature,
204        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::AlterTableAddColumnDuplicateDefault });
205    SQL_FEATURE_ALTER_TABLE_ADD_COLUMN_MODIFIERS = 33 => QueryUnsupportedSqlFeature,
206        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::AlterTableAddColumnModifiers });
207    SQL_FEATURE_ALTER_TABLE_ADD_STATEMENT_BEYOND_ADD_COLUMN = 34 => QueryUnsupportedSqlFeature,
208        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::AlterTableAddStatementBeyondAddColumn });
209    SQL_FEATURE_ALTER_TABLE_ALTER_COLUMN_DROP_UNSUPPORTED_ACTION = 35 => QueryUnsupportedSqlFeature,
210        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::AlterTableAlterColumnDropUnsupportedAction });
211    SQL_FEATURE_ALTER_TABLE_ALTER_COLUMN_MODIFIERS = 36 => QueryUnsupportedSqlFeature,
212        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::AlterTableAlterColumnModifiers });
213    SQL_FEATURE_ALTER_TABLE_ALTER_COLUMN_SET_UNSUPPORTED_ACTION = 37 => QueryUnsupportedSqlFeature,
214        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::AlterTableAlterColumnSetUnsupportedAction });
215    SQL_FEATURE_ALTER_TABLE_ALTER_COLUMN_UNSUPPORTED_ACTION = 38 => QueryUnsupportedSqlFeature,
216        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::AlterTableAlterColumnUnsupportedAction });
217    SQL_FEATURE_ALTER_TABLE_ALTER_STATEMENT_BEYOND_ALTER_COLUMN = 39 => QueryUnsupportedSqlFeature,
218        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::AlterTableAlterStatementBeyondAlterColumn });
219    SQL_FEATURE_ALTER_TABLE_DROP_COLUMN_IF_EXISTS_SYNTAX = 40 => QueryUnsupportedSqlFeature,
220        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::AlterTableDropColumnIfExistsSyntax });
221    SQL_FEATURE_ALTER_TABLE_DROP_COLUMN_MODIFIERS = 41 => QueryUnsupportedSqlFeature,
222        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::AlterTableDropColumnModifiers });
223    SQL_FEATURE_ALTER_TABLE_DROP_STATEMENT_BEYOND_DROP_COLUMN = 42 => QueryUnsupportedSqlFeature,
224        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::AlterTableDropStatementBeyondDropColumn });
225    SQL_FEATURE_ALTER_TABLE_RENAME_COLUMN_MISSING_TO = 43 => QueryUnsupportedSqlFeature,
226        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::AlterTableRenameColumnMissingTo });
227    SQL_FEATURE_ALTER_TABLE_RENAME_COLUMN_MODIFIERS = 44 => QueryUnsupportedSqlFeature,
228        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::AlterTableRenameColumnModifiers });
229    SQL_FEATURE_ALTER_TABLE_RENAME_STATEMENT_BEYOND_RENAME_COLUMN = 45 => QueryUnsupportedSqlFeature,
230        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::AlterTableRenameStatementBeyondRenameColumn });
231    SQL_FEATURE_ALTER_TABLE_UNSUPPORTED_OPERATION = 46 => QueryUnsupportedSqlFeature,
232        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::AlterTableUnsupportedOperation });
233    SQL_FEATURE_COLUMN_ALIAS = 47 => QueryUnsupportedSqlFeature,
234        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::ColumnAlias });
235    SQL_FEATURE_CREATE_INDEX_IF_NOT_EXISTS_SYNTAX = 48 => QueryUnsupportedSqlFeature,
236        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::CreateIndexIfNotExistsSyntax });
237    SQL_FEATURE_CREATE_INDEX_KEY_ORDERING_MODIFIERS = 49 => QueryUnsupportedSqlFeature,
238        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::CreateIndexKeyOrderingModifiers });
239    SQL_FEATURE_CREATE_INDEX_MODIFIERS = 50 => QueryUnsupportedSqlFeature,
240        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::CreateIndexModifiers });
241    SQL_FEATURE_CREATE_STATEMENT_BEYOND_CREATE_INDEX = 51 => QueryUnsupportedSqlFeature,
242        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::CreateStatementBeyondCreateIndex });
243    SQL_FEATURE_DESCRIBE_MODIFIER = 52 => QueryUnsupportedSqlFeature,
244        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::DescribeModifier });
245    SQL_FEATURE_DDL_SCHEMA_VERSION_DUPLICATE_EXPECTED_CLAUSE = 53 => QueryUnsupportedSqlFeature,
246        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::DdlSchemaVersionDuplicateExpectedClause });
247    SQL_FEATURE_DDL_SCHEMA_VERSION_DUPLICATE_SET_CLAUSE = 54 => QueryUnsupportedSqlFeature,
248        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::DdlSchemaVersionDuplicateSetClause });
249    SQL_FEATURE_DROP_INDEX_MODIFIERS = 55 => QueryUnsupportedSqlFeature,
250        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::DropIndexModifiers });
251    SQL_FEATURE_DROP_INDEX_IF_EXISTS_SYNTAX = 56 => QueryUnsupportedSqlFeature,
252        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::DropIndexIfExistsSyntax });
253    SQL_FEATURE_DROP_STATEMENT_BEYOND_DROP_INDEX = 57 => QueryUnsupportedSqlFeature,
254        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::DropStatementBeyondDropIndex });
255    SQL_FEATURE_EXPRESSION_INDEX_UNSUPPORTED_FUNCTION = 58 => QueryUnsupportedSqlFeature,
256        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::ExpressionIndexUnsupportedFunction });
257    SQL_FEATURE_HAVING = 59 => QueryUnsupportedSqlFeature,
258        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::Having });
259    SQL_FEATURE_INSERT = 60 => QueryUnsupportedSqlFeature,
260        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::Insert });
261    SQL_FEATURE_JOIN = 61 => QueryUnsupportedSqlFeature,
262        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::Join });
263    SQL_FEATURE_LIKE_PATTERN_BEYOND_TRAILING_PREFIX = 62 => QueryUnsupportedSqlFeature,
264        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::LikePatternBeyondTrailingPrefix });
265    SQL_FEATURE_LOWER_FIELD_PREDICATE_UNSUPPORTED = 63 => QueryUnsupportedSqlFeature,
266        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::LowerFieldPredicateUnsupported });
267    SQL_FEATURE_MULTI_STATEMENT_SQL = 64 => QueryUnsupportedSqlFeature,
268        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::MultiStatementSql });
269    SQL_FEATURE_NESTED_AGGREGATE_INPUT = 65 => QueryUnsupportedSqlFeature,
270        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::NestedAggregateInput });
271    SQL_FEATURE_NESTED_PROJECTION_FUNCTION_IN_ARITHMETIC = 66 => QueryUnsupportedSqlFeature,
272        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::NestedProjectionFunctionInArithmetic });
273    SQL_FEATURE_ORDER_BY_UNSUPPORTED_FORM = 67 => QueryUnsupportedSqlFeature,
274        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::OrderByUnsupportedForm });
275    SQL_FEATURE_OTHER = 68 => QueryUnsupportedSqlFeature,
276        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::Other });
277    SQL_FEATURE_PREDICATE_STARTS_WITH_FIRST_ARGUMENT = 69 => QueryUnsupportedSqlFeature,
278        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::PredicateStartsWithFirstArgument });
279    SQL_FEATURE_QUOTED_IDENTIFIERS = 70 => QueryUnsupportedSqlFeature,
280        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::QuotedIdentifiers });
281    SQL_FEATURE_RETURNING_UNSUPPORTED_SHAPE = 71 => QueryUnsupportedSqlFeature,
282        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::ReturningUnsupportedShape });
283    SQL_FEATURE_SCALAR_FUNCTION_EXPRESSION_POSITION = 72 => QueryUnsupportedSqlFeature,
284        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::ScalarFunctionExpressionPosition });
285    SQL_FEATURE_SCALE_TAKING_NUMERIC_FUNCTION_EXPRESSION_POSITION = 73 => QueryUnsupportedSqlFeature,
286        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::ScaleTakingNumericFunctionExpressionPosition });
287    SQL_FEATURE_SHOW_COLUMNS_MODIFIERS = 74 => QueryUnsupportedSqlFeature,
288        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::ShowColumnsModifiers });
289    SQL_FEATURE_SHOW_ENTITIES_MODIFIERS = 75 => QueryUnsupportedSqlFeature,
290        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::ShowEntitiesModifiers });
291    SQL_FEATURE_SHOW_INDEXES_MODIFIERS = 76 => QueryUnsupportedSqlFeature,
292        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::ShowIndexesModifiers });
293    SQL_FEATURE_SHOW_MEMORY_MODIFIERS = 77 => QueryUnsupportedSqlFeature,
294        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::ShowMemoryModifiers });
295    SQL_FEATURE_SHOW_STORES_MODIFIERS = 78 => QueryUnsupportedSqlFeature,
296        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::ShowStoresModifiers });
297    SQL_FEATURE_SHOW_UNSUPPORTED_COMMAND = 79 => QueryUnsupportedSqlFeature,
298        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::ShowUnsupportedCommand });
299    SQL_FEATURE_SIMPLE_CASE_EXPRESSION = 80 => QueryUnsupportedSqlFeature,
300        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::SimpleCaseExpression });
301    SQL_FEATURE_STANDALONE_LITERAL_PROJECTION_ITEM = 81 => QueryUnsupportedSqlFeature,
302        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::StandaloneLiteralProjectionItem });
303    SQL_FEATURE_UNION_INTERSECT_EXCEPT = 82 => QueryUnsupportedSqlFeature,
304        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::UnionIntersectExcept });
305    SQL_FEATURE_UNSUPPORTED_FUNCTION_NAMESPACE = 83 => QueryUnsupportedSqlFeature,
306        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::UnsupportedFunctionNamespace });
307    SQL_FEATURE_UPDATE = 84 => QueryUnsupportedSqlFeature,
308        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::Update });
309    SQL_FEATURE_UPPER_FIELD_PREDICATE_UNSUPPORTED = 85 => QueryUnsupportedSqlFeature,
310        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::UpperFieldPredicateUnsupported });
311    SQL_FEATURE_WINDOW_FUNCTION = 86 => QueryUnsupportedSqlFeature,
312        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::WindowFunction });
313    SQL_FEATURE_WITH = 87 => QueryUnsupportedSqlFeature,
314        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::With });
315    SQL_FEATURE_NUMERIC_SCALE_FUNCTION_ARGUMENTS = 88 => QueryUnsupportedSqlFeature,
316        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::NumericScaleFunctionArguments });
317    SQL_FEATURE_ORDER_BY_FIELD_NOT_ORDERABLE = 89 => QueryUnsupportedSqlFeature,
318        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::OrderByFieldNotOrderable });
319
320    SQL_SURFACE_QUERY_REJECTS_INSERT = 90 => QuerySqlSurfaceMismatch,
321        detail(SqlSurfaceMismatch { mismatch: SqlSurfaceMismatchCode::QueryRejectsInsert });
322    SQL_SURFACE_QUERY_REJECTS_UPDATE = 91 => QuerySqlSurfaceMismatch,
323        detail(SqlSurfaceMismatch { mismatch: SqlSurfaceMismatchCode::QueryRejectsUpdate });
324    SQL_SURFACE_QUERY_REJECTS_DELETE = 92 => QuerySqlSurfaceMismatch,
325        detail(SqlSurfaceMismatch { mismatch: SqlSurfaceMismatchCode::QueryRejectsDelete });
326    SQL_SURFACE_MUTATION_REJECTS_SELECT = 93 => QuerySqlSurfaceMismatch,
327        detail(SqlSurfaceMismatch { mismatch: SqlSurfaceMismatchCode::MutationRejectsSelect });
328    SQL_SURFACE_MUTATION_REJECTS_EXPLAIN = 94 => QuerySqlSurfaceMismatch,
329        detail(SqlSurfaceMismatch { mismatch: SqlSurfaceMismatchCode::MutationRejectsExplain });
330    SQL_SURFACE_MUTATION_REJECTS_DESCRIBE = 95 => QuerySqlSurfaceMismatch,
331        detail(SqlSurfaceMismatch { mismatch: SqlSurfaceMismatchCode::MutationRejectsDescribe });
332    SQL_SURFACE_MUTATION_REJECTS_SHOW_INDEXES = 96 => QuerySqlSurfaceMismatch,
333        detail(SqlSurfaceMismatch { mismatch: SqlSurfaceMismatchCode::MutationRejectsShowIndexes });
334    SQL_SURFACE_MUTATION_REJECTS_SHOW_COLUMNS = 97 => QuerySqlSurfaceMismatch,
335        detail(SqlSurfaceMismatch { mismatch: SqlSurfaceMismatchCode::MutationRejectsShowColumns });
336    SQL_SURFACE_MUTATION_REJECTS_SHOW_ENTITIES = 98 => QuerySqlSurfaceMismatch,
337        detail(SqlSurfaceMismatch { mismatch: SqlSurfaceMismatchCode::MutationRejectsShowEntities });
338    SQL_SURFACE_MUTATION_REJECTS_SHOW_STORES = 99 => QuerySqlSurfaceMismatch,
339        detail(SqlSurfaceMismatch { mismatch: SqlSurfaceMismatchCode::MutationRejectsShowStores });
340    SQL_SURFACE_MUTATION_REJECTS_SHOW_MEMORY = 100 => QuerySqlSurfaceMismatch,
341        detail(SqlSurfaceMismatch { mismatch: SqlSurfaceMismatchCode::MutationRejectsShowMemory });
342
343    SCHEMA_DDL_MISSING_EXPECTED_SCHEMA_VERSION = 101 => SchemaDdlAdmission,
344        detail(SchemaDdlAdmission { reason: SchemaDdlAdmissionCode::MissingExpectedSchemaVersion });
345    SCHEMA_DDL_MISSING_NEXT_SCHEMA_VERSION = 102 => SchemaDdlAdmission,
346        detail(SchemaDdlAdmission { reason: SchemaDdlAdmissionCode::MissingNextSchemaVersion });
347    SCHEMA_DDL_STALE_EXPECTED_SCHEMA_VERSION = 103 => SchemaDdlAdmission,
348        detail(SchemaDdlAdmission { reason: SchemaDdlAdmissionCode::StaleExpectedSchemaVersion });
349    SCHEMA_DDL_INVALID_EXPECTED_SCHEMA_VERSION = 104 => SchemaDdlAdmission,
350        detail(SchemaDdlAdmission { reason: SchemaDdlAdmissionCode::InvalidExpectedSchemaVersion });
351    SCHEMA_DDL_INVALID_NEXT_SCHEMA_VERSION = 105 => SchemaDdlAdmission,
352        detail(SchemaDdlAdmission { reason: SchemaDdlAdmissionCode::InvalidNextSchemaVersion });
353    SCHEMA_DDL_ACCEPTED_SCHEMA_CHANGE_WITHOUT_VERSION_BUMP = 106 => SchemaDdlAdmission,
354        detail(SchemaDdlAdmission { reason: SchemaDdlAdmissionCode::AcceptedSchemaChangeWithoutVersionBump });
355    SCHEMA_DDL_EMPTY_VERSION_BUMP = 107 => SchemaDdlAdmission,
356        detail(SchemaDdlAdmission { reason: SchemaDdlAdmissionCode::EmptyVersionBump });
357    SCHEMA_DDL_VERSION_GAP = 108 => SchemaDdlAdmission,
358        detail(SchemaDdlAdmission { reason: SchemaDdlAdmissionCode::VersionGap });
359    SCHEMA_DDL_VERSION_ROLLBACK = 109 => SchemaDdlAdmission,
360        detail(SchemaDdlAdmission { reason: SchemaDdlAdmissionCode::VersionRollback });
361    SCHEMA_DDL_FINGERPRINT_METHOD_MISMATCH = 110 => SchemaDdlAdmission,
362        detail(SchemaDdlAdmission { reason: SchemaDdlAdmissionCode::FingerprintMethodMismatch });
363    SCHEMA_DDL_UNSUPPORTED_TRANSITION_CLASS = 111 => SchemaDdlAdmission,
364        detail(SchemaDdlAdmission { reason: SchemaDdlAdmissionCode::UnsupportedTransitionClass });
365    SCHEMA_DDL_PHYSICAL_RUNNER_MISSING = 112 => SchemaDdlAdmission,
366        detail(SchemaDdlAdmission { reason: SchemaDdlAdmissionCode::PhysicalRunnerMissing });
367    SCHEMA_DDL_VALIDATION_FAILED = 113 => SchemaDdlAdmission,
368        detail(SchemaDdlAdmission { reason: SchemaDdlAdmissionCode::ValidationFailed });
369    SCHEMA_DDL_PUBLICATION_RACE_LOST = 114 => SchemaDdlAdmission,
370        detail(SchemaDdlAdmission { reason: SchemaDdlAdmissionCode::PublicationRaceLost });
371    SCHEMA_DDL_INVALID_ADD_COLUMN_DEFAULT = 115 => SchemaDdlAdmission,
372        detail(SchemaDdlAdmission { reason: SchemaDdlAdmissionCode::InvalidAddColumnDefault });
373    SCHEMA_DDL_INVALID_ALTER_COLUMN_DEFAULT = 116 => SchemaDdlAdmission,
374        detail(SchemaDdlAdmission { reason: SchemaDdlAdmissionCode::InvalidAlterColumnDefault });
375    SCHEMA_DDL_GENERATED_INDEX_DROP_REJECTED = 117 => SchemaDdlAdmission,
376        detail(SchemaDdlAdmission { reason: SchemaDdlAdmissionCode::GeneratedIndexDropRejected });
377    SCHEMA_DDL_REWRITE_REQUIRES_MIGRATION = 118 => SchemaDdlAdmission,
378        detail(SchemaDdlAdmission { reason: SchemaDdlAdmissionCode::SchemaRewriteRequiresMigration });
379    SCHEMA_DDL_GENERATED_FIELD_DEFAULT_CHANGE_REJECTED = 119 => SchemaDdlAdmission,
380        detail(SchemaDdlAdmission { reason: SchemaDdlAdmissionCode::GeneratedFieldDefaultChangeRejected });
381    SCHEMA_DDL_GENERATED_FIELD_NULLABILITY_CHANGE_REJECTED = 120 => SchemaDdlAdmission,
382        detail(SchemaDdlAdmission { reason: SchemaDdlAdmissionCode::GeneratedFieldNullabilityChangeRejected });
383    SQL_FEATURE_SHOW_CONSTRAINTS_MODIFIERS = 121 => QueryUnsupportedSqlFeature,
384        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::ShowConstraintsModifiers });
385    QUERY_SQL_WRITE_BOUNDARY = 122 => QuerySqlWriteBoundary;
386    SQL_WRITE_PRIMARY_KEY_LITERAL_INCOMPATIBLE = 123 => QuerySqlWriteBoundary,
387        detail(SqlWriteBoundary { boundary: SqlWriteBoundaryCode::PrimaryKeyLiteralIncompatible });
388    SQL_WRITE_MISSING_PRIMARY_KEY = 124 => QuerySqlWriteBoundary,
389        detail(SqlWriteBoundary { boundary: SqlWriteBoundaryCode::MissingPrimaryKey });
390    SQL_WRITE_MISSING_REQUIRED_FIELDS = 125 => QuerySqlWriteBoundary,
391        detail(SqlWriteBoundary { boundary: SqlWriteBoundaryCode::MissingRequiredFields });
392    SQL_WRITE_EXPLICIT_MANAGED_FIELD = 126 => QuerySqlWriteBoundary,
393        detail(SqlWriteBoundary { boundary: SqlWriteBoundaryCode::ExplicitManagedField });
394    SQL_WRITE_EXPLICIT_GENERATED_FIELD = 127 => QuerySqlWriteBoundary,
395        detail(SqlWriteBoundary { boundary: SqlWriteBoundaryCode::ExplicitGeneratedField });
396    SQL_WRITE_INSERT_SELECT_REQUIRES_SCALAR = 128 => QuerySqlWriteBoundary,
397        detail(SqlWriteBoundary { boundary: SqlWriteBoundaryCode::InsertSelectRequiresScalar });
398    SQL_WRITE_INSERT_SELECT_AGGREGATE_PROJECTION = 129 => QuerySqlWriteBoundary,
399        detail(SqlWriteBoundary { boundary: SqlWriteBoundaryCode::InsertSelectAggregateProjection });
400    SQL_WRITE_INSERT_SELECT_WIDTH_MISMATCH = 130 => QuerySqlWriteBoundary,
401        detail(SqlWriteBoundary { boundary: SqlWriteBoundaryCode::InsertSelectWidthMismatch });
402    SQL_WRITE_UPDATE_PRIMARY_KEY_MUTATION = 131 => QuerySqlWriteBoundary,
403        detail(SqlWriteBoundary { boundary: SqlWriteBoundaryCode::UpdatePrimaryKeyMutation });
404    SQL_WRITE_INVALID_FIELD_LITERAL = 132 => QuerySqlWriteBoundary,
405        detail(SqlWriteBoundary { boundary: SqlWriteBoundaryCode::InvalidFieldLiteral });
406    SQL_WRITE_UNKNOWN_RETURNING_FIELD = 133 => QuerySqlWriteBoundary,
407        detail(SqlWriteBoundary { boundary: SqlWriteBoundaryCode::UnknownReturningField });
408    SQL_WRITE_DUPLICATE_RETURNING_FIELD = 134 => QuerySqlWriteBoundary,
409        detail(SqlWriteBoundary { boundary: SqlWriteBoundaryCode::DuplicateReturningField });
410    SQL_WRITE_UPDATE_MISSING_WHERE_PREDICATE = 135 => QuerySqlWriteBoundary,
411        detail(SqlWriteBoundary { boundary: SqlWriteBoundaryCode::UpdateMissingWherePredicate });
412    SQL_WRITE_ORDER_BY_UNSUPPORTED_SHAPE = 136 => QuerySqlWriteBoundary,
413        detail(SqlWriteBoundary { boundary: SqlWriteBoundaryCode::WriteOrderByUnsupportedShape });
414
415    QUERY_UNSUPPORTED_PROJECTION = 137 => QueryUnsupportedProjection;
416    QUERY_PROJECTION_NUMERIC_LITERAL_REQUIRED = 138 => QueryUnsupportedProjection,
417        detail(QueryProjection { reason: QueryProjectionCode::NumericLiteralRequired });
418    QUERY_PROJECTION_NUMERIC_SCALE_ARGUMENTS = 139 => QueryUnsupportedProjection,
419        detail(QueryProjection { reason: QueryProjectionCode::NumericScaleArguments });
420    QUERY_PROJECTION_NESTED_FIELD_PATH_PREVIEW = 140 => QueryUnsupportedProjection,
421        detail(QueryProjection { reason: QueryProjectionCode::NestedFieldPathPreview });
422    QUERY_PROJECTION_CASE_CONDITION_BOOLEAN_REQUIRED = 141 => QueryUnsupportedProjection,
423        detail(QueryProjection { reason: QueryProjectionCode::CaseConditionBooleanRequired });
424    QUERY_PROJECTION_NUMERIC_INPUT_REQUIRED = 142 => QueryUnsupportedProjection,
425        detail(QueryProjection { reason: QueryProjectionCode::NumericInputRequired });
426    QUERY_PROJECTION_TEXT_OR_BLOB_INPUT_REQUIRED = 143 => QueryUnsupportedProjection,
427        detail(QueryProjection { reason: QueryProjectionCode::TextOrBlobInputRequired });
428    QUERY_PROJECTION_TEXT_INPUT_REQUIRED = 144 => QueryUnsupportedProjection,
429        detail(QueryProjection { reason: QueryProjectionCode::TextInputRequired });
430    QUERY_PROJECTION_TEXT_OR_NULL_ARGUMENT_REQUIRED = 145 => QueryUnsupportedProjection,
431        detail(QueryProjection { reason: QueryProjectionCode::TextOrNullArgumentRequired });
432    QUERY_PROJECTION_INTEGER_OR_NULL_ARGUMENT_REQUIRED = 146 => QueryUnsupportedProjection,
433        detail(QueryProjection { reason: QueryProjectionCode::IntegerOrNullArgumentRequired });
434    QUERY_PROJECTION_UNARY_OPERAND_INCOMPATIBLE = 147 => QueryUnsupportedProjection,
435        detail(QueryProjection { reason: QueryProjectionCode::UnaryOperandIncompatible });
436    QUERY_PROJECTION_BINARY_OPERANDS_INCOMPATIBLE = 148 => QueryUnsupportedProjection,
437        detail(QueryProjection { reason: QueryProjectionCode::BinaryOperandsIncompatible });
438
439    SQL_LOWERING_ENTITY_MISMATCH = 149 => QueryUnsupportedSqlFeature,
440        detail(SqlLowering { reason: SqlLoweringCode::EntityMismatch });
441    SQL_LOWERING_SELECT_PROJECTION_SHAPE = 150 => QueryUnsupportedSqlFeature,
442        detail(SqlLowering { reason: SqlLoweringCode::SelectProjectionShape });
443    SQL_LOWERING_SELECT_DISTINCT = 151 => QueryUnsupportedSqlFeature,
444        detail(SqlLowering { reason: SqlLoweringCode::SelectDistinct });
445    SQL_LOWERING_DISTINCT_ORDER_BY_PROJECTION = 152 => QueryUnsupportedSqlFeature,
446        detail(SqlLowering { reason: SqlLoweringCode::DistinctOrderByProjection });
447    SQL_LOWERING_GLOBAL_AGGREGATE_PROJECTION = 153 => QueryUnsupportedSqlFeature,
448        detail(SqlLowering { reason: SqlLoweringCode::GlobalAggregateProjection });
449    SQL_LOWERING_GLOBAL_AGGREGATE_GROUP_BY = 154 => QueryUnsupportedSqlFeature,
450        detail(SqlLowering { reason: SqlLoweringCode::GlobalAggregateGroupBy });
451    SQL_LOWERING_SELECT_GROUP_BY_SHAPE = 155 => QueryUnsupportedSqlFeature,
452        detail(SqlLowering { reason: SqlLoweringCode::SelectGroupByShape });
453    SQL_LOWERING_GROUPED_PROJECTION_EXPLICIT_LIST_REQUIRED = 156 => QueryUnsupportedSqlFeature,
454        detail(SqlLowering { reason: SqlLoweringCode::GroupedProjectionExplicitListRequired });
455    SQL_LOWERING_GROUPED_PROJECTION_AGGREGATE_REQUIRED = 157 => QueryUnsupportedSqlFeature,
456        detail(SqlLowering { reason: SqlLoweringCode::GroupedProjectionAggregateRequired });
457    SQL_LOWERING_GROUPED_PROJECTION_NON_GROUP_FIELD = 158 => QueryUnsupportedSqlFeature,
458        detail(SqlLowering { reason: SqlLoweringCode::GroupedProjectionNonGroupField });
459    SQL_LOWERING_GROUPED_PROJECTION_SCALAR_AFTER_AGGREGATE = 159 => QueryUnsupportedSqlFeature,
460        detail(SqlLowering { reason: SqlLoweringCode::GroupedProjectionScalarAfterAggregate });
461    SQL_LOWERING_HAVING_REQUIRES_GROUP_BY = 160 => QueryUnsupportedSqlFeature,
462        detail(SqlLowering { reason: SqlLoweringCode::HavingRequiresGroupBy });
463    SQL_LOWERING_SELECT_HAVING_SHAPE = 161 => QueryUnsupportedSqlFeature,
464        detail(SqlLowering { reason: SqlLoweringCode::SelectHavingShape });
465    SQL_LOWERING_AGGREGATE_INPUT_EXPRESSIONS = 162 => QueryUnsupportedSqlFeature,
466        detail(SqlLowering { reason: SqlLoweringCode::AggregateInputExpressions });
467    SQL_LOWERING_WHERE_EXPRESSION_SHAPE = 163 => QueryUnsupportedSqlFeature,
468        detail(SqlLowering { reason: SqlLoweringCode::WhereExpressionShape });
469    SQL_LOWERING_PARAMETER_PLACEMENT = 164 => QueryUnsupportedSqlFeature,
470        detail(SqlLowering { reason: SqlLoweringCode::ParameterPlacement });
471    SQL_LOWERING_SQL_DDL_EXECUTION_UNSUPPORTED = 165 => QueryUnsupportedSqlFeature,
472        detail(SqlLowering { reason: SqlLoweringCode::SqlDdlExecutionUnsupported });
473
474    SQL_WRITE_RETURNING_RESPONSE_TOO_LARGE = 166 => QuerySqlWriteBoundary,
475        detail(SqlWriteBoundary { boundary: SqlWriteBoundaryCode::ReturningResponseTooLarge });
476    SQL_WRITE_RETURNING_ROWS_TOO_MANY = 167 => QuerySqlWriteBoundary,
477        detail(SqlWriteBoundary { boundary: SqlWriteBoundaryCode::ReturningRowsTooMany });
478    RUNTIME_BOUNDARY_SQL_INTROSPECTION_DISABLED = 168 => RuntimeUnsupported,
479        detail(RuntimeBoundary { boundary: RuntimeBoundaryCode::SqlIntrospectionDisabled });
480    SQL_WRITE_STAGED_ROWS_TOO_MANY = 169 => QuerySqlWriteBoundary,
481        detail(SqlWriteBoundary { boundary: SqlWriteBoundaryCode::StagedRowsTooMany });
482
483    QUERY_READ_ADMISSION = 170 => QueryReadAdmission;
484    QUERY_READ_PUBLIC_REQUIRES_LIMIT = 171 => QueryReadAdmission,
485        detail(QueryReadAdmission { reason: QueryReadAdmissionCode::PublicQueryRequiresLimit });
486    QUERY_READ_PUBLIC_REQUIRES_INDEX = 172 => QueryReadAdmission,
487        detail(QueryReadAdmission { reason: QueryReadAdmissionCode::PublicQueryRequiresIndex });
488    QUERY_READ_UNBOUNDED_FULL_SCAN_REJECTED = 173 => QueryReadAdmission,
489        detail(QueryReadAdmission { reason: QueryReadAdmissionCode::UnboundedFullScanRejected });
490    QUERY_READ_SORT_REQUIRES_MATERIALIZATION = 174 => QueryReadAdmission,
491        detail(QueryReadAdmission { reason: QueryReadAdmissionCode::SortRequiresMaterialization });
492    QUERY_READ_GROUPED_QUERY_REQUIRES_LIMITS = 175 => QueryReadAdmission,
493        detail(QueryReadAdmission { reason: QueryReadAdmissionCode::GroupedQueryRequiresLimits });
494    QUERY_READ_GROUPED_QUERY_EXCEEDS_BUDGET = 176 => QueryReadAdmission,
495        detail(QueryReadAdmission { reason: QueryReadAdmissionCode::GroupedQueryExceedsBudget });
496    QUERY_READ_DIAGNOSTIC_LANE_DOES_NOT_EXECUTE = 177 => QueryReadAdmission,
497        detail(QueryReadAdmission { reason: QueryReadAdmissionCode::DiagnosticLaneDoesNotExecute });
498    QUERY_READ_RETURNED_ROW_BOUND_EXCEEDS_POLICY = 178 => QueryReadAdmission,
499        detail(QueryReadAdmission { reason: QueryReadAdmissionCode::ReturnedRowBoundExceedsPolicy });
500    QUERY_READ_PRIMARY_KEY_INPUT_EXCEEDS_POLICY = 179 => QueryReadAdmission,
501        detail(QueryReadAdmission { reason: QueryReadAdmissionCode::PrimaryKeyInputExceedsPolicy });
502
503    SCHEMA_DDL_ROW_LAYOUT_VERSION_EXHAUSTED = 180 => SchemaDdlAdmission,
504        detail(SchemaDdlAdmission { reason: SchemaDdlAdmissionCode::RowLayoutVersionExhausted });
505    SCHEMA_DDL_TRANSITION_BUDGET_EXCEEDED = 181 => SchemaDdlAdmission,
506        detail(SchemaDdlAdmission { reason: SchemaDdlAdmissionCode::SchemaTransitionBudgetExceeded });
507    SQL_WRITE_INSERT_DEFAULT_REQUIRED_FIELD = 182 => QuerySqlWriteBoundary,
508        detail(SqlWriteBoundary { boundary: SqlWriteBoundaryCode::InsertDefaultRequiredField });
509    SQL_WRITE_UPDATE_DEFAULT_REQUIRED_FIELD = 183 => QuerySqlWriteBoundary,
510        detail(SqlWriteBoundary { boundary: SqlWriteBoundaryCode::UpdateDefaultRequiredField });
511    SQL_WRITE_UPDATE_DEFAULT_DATABASE_OWNED_FIELD = 184 => QuerySqlWriteBoundary,
512        detail(SqlWriteBoundary { boundary: SqlWriteBoundaryCode::UpdateDefaultDatabaseOwnedField });
513    RUNTIME_BOUNDARY_MUTATION_REQUIRED_FIELD_MISSING = 185 => RuntimeUnsupported,
514        detail(RuntimeBoundary { boundary: RuntimeBoundaryCode::MutationRequiredFieldMissing });
515    RUNTIME_BOUNDARY_PERSISTED_ROW_LAYOUT_OUTSIDE_ACCEPTED_WINDOW = 186 => RuntimeCorruption,
516        detail(RuntimeBoundary { boundary: RuntimeBoundaryCode::PersistedRowLayoutOutsideAcceptedWindow });
517    RUNTIME_BOUNDARY_PERSISTED_ROW_SLOT_COUNT_MISMATCH = 187 => RuntimeCorruption,
518        detail(RuntimeBoundary { boundary: RuntimeBoundaryCode::PersistedRowSlotCountMismatch });
519    RUNTIME_BOUNDARY_GENERATED_FIELD_AFTER_DDL_FIELD = 188 => RuntimeUnsupported,
520        detail(RuntimeBoundary { boundary: RuntimeBoundaryCode::GeneratedFieldAfterDdlField });
521    SQL_SURFACE_MUTATION_REQUIRES_EXPLICIT_UPDATE_INTENT = 189 => QuerySqlSurfaceMismatch,
522        detail(SqlSurfaceMismatch { mismatch: SqlSurfaceMismatchCode::MutationRequiresExplicitUpdateIntent });
523    SQL_WRITE_EXACT_UPDATE_ASSERTION_REQUIRED = 190 => QuerySqlWriteBoundary,
524        detail(SqlWriteBoundary { boundary: SqlWriteBoundaryCode::ExactUpdateAssertionRequired });
525    SQL_WRITE_EXACT_UPDATE_ASSERTION_TOO_HIGH = 191 => QuerySqlWriteBoundary,
526        detail(SqlWriteBoundary { boundary: SqlWriteBoundaryCode::ExactUpdateAssertionTooHigh });
527    SQL_WRITE_EXACT_UPDATE_AFFECTED_ROWS_EXCEEDED = 192 => QuerySqlWriteBoundary,
528        detail(SqlWriteBoundary { boundary: SqlWriteBoundaryCode::ExactUpdateAffectedRowsExceeded });
529    SQL_WRITE_EXACT_UPDATE_WINDOW_UNSUPPORTED = 193 => QuerySqlWriteBoundary,
530        detail(SqlWriteBoundary { boundary: SqlWriteBoundaryCode::ExactUpdateWindowUnsupported });
531    SQL_WRITE_EXACT_UPDATE_SCAN_BUDGET_EXCEEDED = 194 => QuerySqlWriteBoundary,
532        detail(SqlWriteBoundary { boundary: SqlWriteBoundaryCode::ExactUpdateScanBudgetExceeded });
533    SQL_WRITE_RESUMABLE_UPDATE_WINDOW_UNSUPPORTED = 195 => QuerySqlWriteBoundary,
534        detail(SqlWriteBoundary { boundary: SqlWriteBoundaryCode::ResumableUpdateWindowUnsupported });
535    SQL_WRITE_RESUMABLE_UPDATE_RETURNING_UNSUPPORTED = 196 => QuerySqlWriteBoundary,
536        detail(SqlWriteBoundary { boundary: SqlWriteBoundaryCode::ResumableUpdateReturningUnsupported });
537    SQL_WRITE_RESUMABLE_UPDATE_REQUIRES_JOURNALED_STORE = 197 => QuerySqlWriteBoundary,
538        detail(SqlWriteBoundary { boundary: SqlWriteBoundaryCode::ResumableUpdateRequiresJournaledStore });
539    SQL_WRITE_RESUMABLE_UPDATE_ASSIGNED_FIELD_HAS_GLOBAL_CONSTRAINT = 198 => QuerySqlWriteBoundary,
540        detail(SqlWriteBoundary { boundary: SqlWriteBoundaryCode::ResumableUpdateAssignedFieldHasGlobalConstraint });
541    SQL_WRITE_RESUMABLE_UPDATE_SCOPE_DEPENDS_ON_ASSIGNED_FIELD = 199 => QuerySqlWriteBoundary,
542        detail(SqlWriteBoundary { boundary: SqlWriteBoundaryCode::ResumableUpdateScopeDependsOnAssignedField });
543    SQL_WRITE_RESUMABLE_UPDATE_SCOPE_DEPENDENCY_UNKNOWN = 200 => QuerySqlWriteBoundary,
544        detail(SqlWriteBoundary { boundary: SqlWriteBoundaryCode::ResumableUpdateScopeDependencyUnknown });
545    SQL_WRITE_RESUMABLE_UPDATE_CONTINUATION_MALFORMED = 201 => QuerySqlWriteBoundary,
546        detail(SqlWriteBoundary { boundary: SqlWriteBoundaryCode::ResumableUpdateContinuationMalformed });
547    SQL_WRITE_RESUMABLE_UPDATE_CONTINUATION_TARGET_MISMATCH = 202 => QuerySqlWriteBoundary,
548        detail(SqlWriteBoundary { boundary: SqlWriteBoundaryCode::ResumableUpdateContinuationTargetMismatch });
549    SQL_WRITE_RESUMABLE_UPDATE_CONTINUATION_SCHEMA_MISMATCH = 203 => QuerySqlWriteBoundary,
550        detail(SqlWriteBoundary { boundary: SqlWriteBoundaryCode::ResumableUpdateContinuationSchemaMismatch });
551    SQL_WRITE_RESUMABLE_UPDATE_CONTINUATION_SCOPE_MISMATCH = 204 => QuerySqlWriteBoundary,
552        detail(SqlWriteBoundary { boundary: SqlWriteBoundaryCode::ResumableUpdateContinuationScopeMismatch });
553    SQL_WRITE_RESUMABLE_UPDATE_CONTINUATION_PATCH_MISMATCH = 205 => QuerySqlWriteBoundary,
554        detail(SqlWriteBoundary { boundary: SqlWriteBoundaryCode::ResumableUpdateContinuationPatchMismatch });
555    SQL_WRITE_RESUMABLE_UPDATE_CONTINUATION_BATCH_POLICY_MISMATCH = 206 => QuerySqlWriteBoundary,
556        detail(SqlWriteBoundary { boundary: SqlWriteBoundaryCode::ResumableUpdateContinuationBatchPolicyMismatch });
557    SQL_WRITE_RESUMABLE_UPDATE_MANAGED_FIELD_HAS_GLOBAL_CONSTRAINT = 207 => QuerySqlWriteBoundary,
558        detail(SqlWriteBoundary { boundary: SqlWriteBoundaryCode::ResumableUpdateManagedFieldHasGlobalConstraint });
559    RUNTIME_BOUNDARY_JOURNAL_MUTATION_REVISION_EXHAUSTED = 208 => RuntimeUnsupported,
560        detail(RuntimeBoundary { boundary: RuntimeBoundaryCode::JournalMutationRevisionExhausted });
561    SQL_SURFACE_MUTATION_REJECTS_SHOW_CONSTRAINTS = 209 => QuerySqlSurfaceMismatch,
562        detail(SqlSurfaceMismatch { mismatch: SqlSurfaceMismatchCode::MutationRejectsShowConstraints });
563    RUNTIME_BOUNDARY_CONSTRAINT_VIOLATION = 210 => RuntimeInvariantViolation,
564        detail(RuntimeBoundary { boundary: RuntimeBoundaryCode::ConstraintViolation });
565    RUNTIME_BOUNDARY_ACCEPTED_ROW_CONSTRAINT_PROGRAM_CORRUPT = 211 => RuntimeCorruption,
566        detail(RuntimeBoundary { boundary: RuntimeBoundaryCode::AcceptedRowConstraintProgramCorrupt });
567    RUNTIME_BOUNDARY_CONSTRAINT_ACTIVATION_WRITE_BLOCKED = 212 => RuntimeConflict,
568        detail(RuntimeBoundary { boundary: RuntimeBoundaryCode::ConstraintActivationWriteBlocked });
569    SQL_FEATURE_ALTER_TABLE_ADD_CONSTRAINT_BEYOND_CHECK = 213 => QueryUnsupportedSqlFeature,
570        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::AlterTableAddConstraintBeyondCheck });
571    SQL_FEATURE_ALTER_TABLE_ADD_CONSTRAINT_MODIFIERS = 214 => QueryUnsupportedSqlFeature,
572        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::AlterTableAddConstraintModifiers });
573    SQL_FEATURE_ALTER_TABLE_DROP_CONSTRAINT_IF_EXISTS_SYNTAX = 215 => QueryUnsupportedSqlFeature,
574        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::AlterTableDropConstraintIfExistsSyntax });
575    SQL_FEATURE_ALTER_TABLE_DROP_CONSTRAINT_MODIFIERS = 216 => QueryUnsupportedSqlFeature,
576        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::AlterTableDropConstraintModifiers });
577    SQL_FEATURE_ALTER_TABLE_VALIDATE_BEYOND_CONSTRAINT = 217 => QueryUnsupportedSqlFeature,
578        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::AlterTableValidateBeyondConstraint });
579    SQL_FEATURE_ALTER_TABLE_VALIDATE_CONSTRAINT_MODIFIERS = 218 => QueryUnsupportedSqlFeature,
580        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::AlterTableValidateConstraintModifiers });
581    RUNTIME_BOUNDARY_GENERATED_CONSTRAINT_ACTIVATION_STALE = 219 => RuntimeConflict,
582        detail(RuntimeBoundary { boundary: RuntimeBoundaryCode::GeneratedConstraintActivationStale });
583    RUNTIME_BOUNDARY_MUTATION_MANAGED_TIMESTAMP_REGRESSION = 220 => RuntimeInvariantViolation,
584        detail(RuntimeBoundary { boundary: RuntimeBoundaryCode::MutationManagedTimestampRegression });
585    RUNTIME_BOUNDARY_MUTATION_DATABASE_OWNED_FIELD_EXPLICIT = 221 => RuntimeUnsupported,
586        detail(RuntimeBoundary { boundary: RuntimeBoundaryCode::MutationDatabaseOwnedFieldExplicit });
587    RUNTIME_BOUNDARY_MUTATION_BATCH_EMPTY = 222 => RuntimeUnsupported,
588        detail(RuntimeBoundary { boundary: RuntimeBoundaryCode::MutationBatchEmpty });
589    RUNTIME_BOUNDARY_MUTATION_BATCH_TOO_MANY_ITEMS = 223 => RuntimeUnsupported,
590        detail(RuntimeBoundary { boundary: RuntimeBoundaryCode::MutationBatchTooManyItems });
591    RUNTIME_BOUNDARY_MUTATION_BATCH_STAGED_BYTES_EXCEEDED = 224 => RuntimeUnsupported,
592        detail(RuntimeBoundary { boundary: RuntimeBoundaryCode::MutationBatchStagedBytesExceeded });
593    RUNTIME_BOUNDARY_MUTATION_BATCH_RESULT_BYTES_EXCEEDED = 225 => RuntimeUnsupported,
594        detail(RuntimeBoundary { boundary: RuntimeBoundaryCode::MutationBatchResultBytesExceeded });
595    RUNTIME_BOUNDARY_MUTATION_BATCH_STORE_MISMATCH = 226 => RuntimeConflict,
596        detail(RuntimeBoundary { boundary: RuntimeBoundaryCode::MutationBatchStoreMismatch });
597    RUNTIME_BOUNDARY_MUTATION_BATCH_DUPLICATE_KEY = 227 => RuntimeConflict,
598        detail(RuntimeBoundary { boundary: RuntimeBoundaryCode::MutationBatchDuplicateKey });
599    RUNTIME_BOUNDARY_OPERATIONAL_SURFACE_CONTROLLER_REQUIRED = 228 => RuntimeUnsupported,
600        detail(RuntimeBoundary { boundary: RuntimeBoundaryCode::OperationalSurfaceControllerRequired });
601    SCHEMA_MIGRATION_UNADOPTED = 229 => RuntimeUnsupported,
602        detail(SchemaMigration { reason: SchemaMigrationCode::Unadopted });
603    SCHEMA_MIGRATION_MISSING_MIGRATION = 230 => RuntimeUnsupported,
604        detail(SchemaMigration { reason: SchemaMigrationCode::MissingMigration });
605    SCHEMA_MIGRATION_VERSION_GAP = 231 => RuntimeUnsupported,
606        detail(SchemaMigration { reason: SchemaMigrationCode::VersionGap });
607    SCHEMA_MIGRATION_DOWNGRADE = 232 => RuntimeUnsupported,
608        detail(SchemaMigration { reason: SchemaMigrationCode::Downgrade });
609    SCHEMA_MIGRATION_EMPTY_ENTITY_VERSION_BUMP = 233 => RuntimeUnsupported,
610        detail(SchemaMigration { reason: SchemaMigrationCode::EmptyEntityVersionBump });
611    SCHEMA_MIGRATION_STALE_ACCEPTED_HEAD = 234 => RuntimeConflict,
612        detail(SchemaMigration { reason: SchemaMigrationCode::StaleAcceptedHead });
613    SCHEMA_MIGRATION_PLAN_CHANGED = 235 => RuntimeConflict,
614        detail(SchemaMigration { reason: SchemaMigrationCode::PlanChanged });
615    SCHEMA_MIGRATION_UNKNOWN_FROM_OBJECT = 236 => RuntimeUnsupported,
616        detail(SchemaMigration { reason: SchemaMigrationCode::UnknownFromObject });
617    SCHEMA_MIGRATION_UNKNOWN_TO_OBJECT = 237 => RuntimeUnsupported,
618        detail(SchemaMigration { reason: SchemaMigrationCode::UnknownToObject });
619    SCHEMA_MIGRATION_KIND_MISMATCH = 238 => RuntimeUnsupported,
620        detail(SchemaMigration { reason: SchemaMigrationCode::KindMismatch });
621    SCHEMA_MIGRATION_IDENTITY_CONFLICT = 239 => RuntimeConflict,
622        detail(SchemaMigration { reason: SchemaMigrationCode::IdentityConflict });
623    SCHEMA_MIGRATION_UNEXPLAINED_SCHEMA_DIFFERENCE = 240 => RuntimeUnsupported,
624        detail(SchemaMigration { reason: SchemaMigrationCode::UnexplainedSchemaDifference });
625    SCHEMA_MIGRATION_UNSUPPORTED_TRANSFORM = 241 => RuntimeUnsupported,
626        detail(SchemaMigration { reason: SchemaMigrationCode::UnsupportedTransform });
627    SCHEMA_MIGRATION_PHYSICAL_RUNNER_MISSING = 242 => RuntimeUnsupported,
628        detail(SchemaMigration { reason: SchemaMigrationCode::PhysicalRunnerMissing });
629    SCHEMA_MIGRATION_IN_PROGRESS = 243 => RuntimeConflict,
630        detail(SchemaMigration { reason: SchemaMigrationCode::MigrationInProgress });
631    SCHEMA_MIGRATION_ABORT_TOO_LATE = 244 => RuntimeConflict,
632        detail(SchemaMigration { reason: SchemaMigrationCode::AbortTooLate });
633    SCHEMA_MIGRATION_PROGRESS_CORRUPT = 245 => RuntimeCorruption,
634        detail(SchemaMigration { reason: SchemaMigrationCode::ProgressCorrupt });
635    SCHEMA_MIGRATION_CANDIDATE_MISMATCH = 246 => RuntimeCorruption,
636        detail(SchemaMigration { reason: SchemaMigrationCode::CandidateMismatch });
637    SCHEMA_MIGRATION_PUBLICATION_RACE_LOST = 247 => RuntimeConflict,
638        detail(SchemaMigration { reason: SchemaMigrationCode::PublicationRaceLost });
639    RUNTIME_BOUNDARY_EXACT_KEY_BATCH_TOO_MANY_ITEMS = 248 => RuntimeUnsupported,
640        detail(RuntimeBoundary { boundary: RuntimeBoundaryCode::ExactKeyBatchTooManyItems });
641    RUNTIME_BOUNDARY_EXACT_KEY_BATCH_INPUT_BYTES_EXCEEDED = 249 => RuntimeUnsupported,
642        detail(RuntimeBoundary { boundary: RuntimeBoundaryCode::ExactKeyBatchInputBytesExceeded });
643    RUNTIME_BOUNDARY_EXACT_KEY_BATCH_STORED_BYTES_EXCEEDED = 250 => RuntimeUnsupported,
644        detail(RuntimeBoundary { boundary: RuntimeBoundaryCode::ExactKeyBatchStoredBytesExceeded });
645    RUNTIME_BOUNDARY_EXACT_KEY_BATCH_RESULT_BYTES_EXCEEDED = 251 => RuntimeUnsupported,
646        detail(RuntimeBoundary { boundary: RuntimeBoundaryCode::ExactKeyBatchResultBytesExceeded });
647    RUNTIME_BOUNDARY_EXECUTION_BUDGET_EXCEEDED = 252 => RuntimeUnsupported,
648        detail(RuntimeBoundary { boundary: RuntimeBoundaryCode::ExecutionBudgetExceeded });
649    RUNTIME_BOUNDARY_PAGE_UNIT_TOO_LARGE = 253 => RuntimeUnsupported,
650        detail(RuntimeBoundary { boundary: RuntimeBoundaryCode::PageUnitTooLarge });
651    RUNTIME_BOUNDARY_REQUEST_EXECUTION_SCOPE_REQUIRED = 254 => RuntimeUnsupported,
652        detail(RuntimeBoundary { boundary: RuntimeBoundaryCode::RequestExecutionScopeRequired });
653    RUNTIME_BOUNDARY_REQUEST_EXECUTION_ROOT_MISMATCH = 255 => RuntimeConflict,
654        detail(RuntimeBoundary { boundary: RuntimeBoundaryCode::RequestExecutionRootMismatch });
655    SQL_FEATURE_SHOW_RELATIONS_MODIFIERS = 256 => QueryUnsupportedSqlFeature,
656        detail(UnsupportedSqlFeature { feature: SqlFeatureCode::ShowRelationsModifiers });
657    SQL_SURFACE_MUTATION_REJECTS_SHOW_RELATIONS = 257 => QuerySqlSurfaceMismatch,
658        detail(SqlSurfaceMismatch { mismatch: SqlSurfaceMismatchCode::MutationRejectsShowRelations });
659    RUNTIME_BOUNDARY_SQL_QUERY_REPLY_BYTES_EXCEEDED = 258 => RuntimeUnsupported,
660        detail(RuntimeBoundary { boundary: RuntimeBoundaryCode::SqlQueryReplyBytesExceeded });
661    RUNTIME_BOUNDARY_DATABASE_STARTUP_RECOVERY_PENDING = 259 => RuntimeConflict,
662        detail(RuntimeBoundary { boundary: RuntimeBoundaryCode::DatabaseStartupRecoveryPending });
663    RUNTIME_BOUNDARY_SQL_SURFACE_POLICY_DENIED = 260 => RuntimeUnsupported,
664        detail(RuntimeBoundary { boundary: RuntimeBoundaryCode::SqlSurfacePolicyDenied });
665    RUNTIME_BOUNDARY_SCHEMA_SURFACE_POLICY_DENIED = 261 => RuntimeUnsupported,
666        detail(RuntimeBoundary { boundary: RuntimeBoundaryCode::SchemaSurfacePolicyDenied });
667    RUNTIME_BOUNDARY_MUTATION_BATCH_COMMIT_WORK_EXCEEDED = 262 => RuntimeUnsupported,
668        detail(RuntimeBoundary { boundary: RuntimeBoundaryCode::MutationBatchCommitWorkExceeded });
669    RUNTIME_BOUNDARY_CONVERGENCE_BACKLOG_PRESSURE = 263 => RuntimeConflict,
670        detail(RuntimeBoundary { boundary: RuntimeBoundaryCode::ConvergenceBacklogPressure });
671    RUNTIME_BOUNDARY_MUTATION_BATCH_TOO_MANY_ENTITIES = 264 => RuntimeUnsupported,
672        detail(RuntimeBoundary { boundary: RuntimeBoundaryCode::MutationBatchTooManyEntities });
673    SQL_LOWERING_BINDING_COUNT = 265 => QueryUnsupportedSqlFeature,
674        detail(SqlLowering { reason: SqlLoweringCode::BindingCount });
675    SQL_LOWERING_BINDING_FAMILY = 266 => QueryUnsupportedSqlFeature,
676        detail(SqlLowering { reason: SqlLoweringCode::BindingFamily });
677    SQL_LOWERING_BINDING_LIMIT = 267 => QueryUnsupportedSqlFeature,
678        detail(SqlLowering { reason: SqlLoweringCode::BindingLimit });
679    QUERY_READ_INPUT_DEPTH_EXCEEDED = 268 => QueryReadAdmission,
680        detail(QueryReadAdmission { reason: QueryReadAdmissionCode::InputDepthExceeded });
681    QUERY_READ_INPUT_NODES_EXCEEDED = 269 => QueryReadAdmission,
682        detail(QueryReadAdmission { reason: QueryReadAdmissionCode::InputNodesExceeded });
683    QUERY_READ_INPUT_BYTES_EXCEEDED = 270 => QueryReadAdmission,
684        detail(QueryReadAdmission { reason: QueryReadAdmissionCode::InputBytesExceeded });
685    RUNTIME_BOUNDARY_QUERY_EXPLAIN_OUTPUT_EXCEEDED = 271 => RuntimeUnsupported,
686        detail(RuntimeBoundary { boundary: RuntimeBoundaryCode::QueryExplainOutputExceeded });
687    RUNTIME_BOUNDARY_QUERY_EXPLAIN_DEPTH_EXCEEDED = 272 => RuntimeUnsupported,
688        detail(RuntimeBoundary { boundary: RuntimeBoundaryCode::QueryExplainDepthExceeded });
689    QUERY_READ_EXPLAIN_DOES_NOT_ACCEPT_CURSOR = 273 => QueryReadAdmission,
690        detail(QueryReadAdmission { reason: QueryReadAdmissionCode::ExplainDoesNotAcceptCursor });
691    RUNTIME_BOUNDARY_MEMORY_BUCKET_SIZE_MISMATCH = 274 => RuntimeConflict,
692        detail(RuntimeBoundary { boundary: RuntimeBoundaryCode::MemoryBucketSizeMismatch });
693    QUERY_EXACT_COUNT_METADATA_UNAVAILABLE = 275 => QueryExactCountMetadataUnavailable;
694}