reifydb-core 0.4.11

Core database interfaces and data structures for ReifyDB
Documentation
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
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2025 ReifyDB

use reifydb_type::{error::Diagnostic, fragment::Fragment, value::r#type::Type};

pub fn namespace_already_exists(fragment: Fragment, namespace: &str) -> Diagnostic {
	Diagnostic {
		code: "CA_001".to_string(),
		rql: None,
		message: format!("namespace `{}` already exists", namespace),
		fragment,
		label: Some("duplicate namespace definition".to_string()),
		help: Some("choose a different name or drop the existing namespace first".to_string()),
		column: None,
		notes: vec![],
		cause: None,
		operator_chain: None,
	}
}

pub fn namespace_not_found(fragment: Fragment, namespace: &str) -> Diagnostic {
	Diagnostic {
		code: "CA_002".to_string(),
		rql: None,
		message: format!("namespace `{}` not found", namespace),
		fragment,
		label: Some("unknown namespace reference".to_string()),
		help: Some("make sure the namespace exists before using it or create it first".to_string()),
		column: None,
		notes: vec![],
		cause: None,
		operator_chain: None,
	}
}

pub fn table_already_exists(fragment: Fragment, namespace: &str, table: &str) -> Diagnostic {
	Diagnostic {
		code: "CA_003".to_string(),
		rql: None,
		message: format!("table `{}::{}` already exists", namespace, table),
		fragment,
		label: Some("duplicate table definition".to_string()),
		help: Some("choose a different name, drop the existing table or create table in a different namespace"
			.to_string()),
		column: None,
		notes: vec![],
		cause: None,
		operator_chain: None,
	}
}

pub fn flow_already_exists(fragment: Fragment, namespace: &str, flow: &str) -> Diagnostic {
	Diagnostic {
		code: "CA_030".to_string(),
		rql: None,
		message: format!("flow `{}::{}` already exists", namespace, flow),
		fragment,
		label: Some("duplicate flow definition".to_string()),
		help: Some("choose a different name, drop the existing flow or create flow in a different namespace"
			.to_string()),
		column: None,
		notes: vec![],
		cause: None,
		operator_chain: None,
	}
}

pub fn flow_not_found(fragment: Fragment, namespace: &str, flow: &str) -> Diagnostic {
	Diagnostic {
		code: "CA_031".to_string(),
		rql: None,
		message: format!("flow `{}::{}` not found", namespace, flow),
		fragment,
		label: Some("unknown flow reference".to_string()),
		help: Some("ensure the flow exists or create it first using `CREATE FLOW`".to_string()),
		column: None,
		notes: vec![],
		cause: None,
		operator_chain: None,
	}
}

pub fn view_already_exists(fragment: Fragment, namespace: &str, view: &str) -> Diagnostic {
	Diagnostic {
		code: "CA_003".to_string(),
		rql: None,
		message: format!("view `{}::{}` already exists", namespace, view),
		fragment,
		label: Some("duplicate view definition".to_string()),
		help: Some("choose a different name, drop the existing view or create view in a different namespace"
			.to_string()),
		column: None,
		notes: vec![],
		cause: None,
		operator_chain: None,
	}
}

pub fn table_not_found(fragment: Fragment, namespace: &str, table: &str) -> Diagnostic {
	Diagnostic {
		code: "CA_004".to_string(),
		rql: None,
		message: format!("table `{}::{}` not found", namespace, table),
		fragment,
		label: Some("unknown table reference".to_string()),
		help: Some("ensure the table exists or create it first using `CREATE TABLE`".to_string()),
		column: None,
		notes: vec![],
		cause: None,
		operator_chain: None,
	}
}

pub fn ringbuffer_already_exists(fragment: Fragment, namespace: &str, ringbuffer: &str) -> Diagnostic {
	Diagnostic {
		code: "CA_005".to_string(),
		rql: None,
		message: format!("ring buffer `{}::{}` already exists", namespace, ringbuffer),
		fragment,
		label: Some("duplicate ring buffer definition".to_string()),
		help: Some(
			"choose a different name, drop the existing ring buffer or create ring buffer in a different namespace"
				.to_string(),
		),
		column: None,
		notes: vec![],
		cause: None,
		operator_chain: None,
	}
}

pub fn ringbuffer_not_found(fragment: Fragment, namespace: &str, ringbuffer: &str) -> Diagnostic {
	Diagnostic {
		code: "CA_006".to_string(),
		rql: None,
		message: format!("ring buffer `{}::{}` not found", namespace, ringbuffer),
		fragment,
		label: Some("unknown ring buffer reference".to_string()),
		help: Some("ensure the ring buffer exists or create it first using `CREATE RING BUFFER`".to_string()),
		column: None,
		notes: vec![],
		cause: None,
		operator_chain: None,
	}
}

pub fn sumtype_already_exists(fragment: Fragment, namespace: &str, name: &str) -> Diagnostic {
	Diagnostic {
		code: "CA_003".to_string(),
		rql: None,
		message: format!("enum `{}::{}` already exists", namespace, name),
		fragment,
		label: Some("duplicate enum definition".to_string()),
		help: Some("choose a different name or drop the existing enum first".to_string()),
		column: None,
		notes: vec![],
		cause: None,
		operator_chain: None,
	}
}

pub fn sumtype_not_found(fragment: Fragment, namespace: &str, name: &str) -> Diagnostic {
	Diagnostic {
		code: "CA_002".to_string(),
		rql: None,
		message: format!("type `{}::{}` not found", namespace, name),
		fragment,
		label: Some("unknown type".to_string()),
		help: Some(format!("create the enum first with `CREATE ENUM {}::{} {{ ... }}`", namespace, name)),
		column: None,
		notes: vec![],
		cause: None,
		operator_chain: None,
	}
}

pub fn dictionary_already_exists(fragment: Fragment, namespace: &str, dictionary: &str) -> Diagnostic {
	Diagnostic {
		code: "CA_006".to_string(),
		rql: None,
		message: format!("dictionary `{}::{}` already exists", namespace, dictionary),
		fragment,
		label: Some("duplicate dictionary definition".to_string()),
		help: Some("choose a different name, drop the existing dictionary or create dictionary in a different namespace".to_string()),
		column: None,
		notes: vec![],
		cause: None,
		operator_chain: None,
	}
}

pub fn dictionary_not_found(fragment: Fragment, namespace: &str, dictionary: &str) -> Diagnostic {
	Diagnostic {
		code: "CA_007".to_string(),
		rql: None,
		message: format!("dictionary `{}::{}` not found", namespace, dictionary),
		fragment,
		label: Some("unknown dictionary reference".to_string()),
		help: Some("ensure the dictionary exists or create it first using `CREATE DICTIONARY`".to_string()),
		column: None,
		notes: vec![],
		cause: None,
		operator_chain: None,
	}
}

pub fn dictionary_type_mismatch(
	fragment: Fragment,
	column: &str,
	column_type: Type,
	dictionary: &str,
	dictionary_value_type: Type,
) -> Diagnostic {
	Diagnostic {
		code: "CA_008".to_string(),
		rql: None,
		message: format!(
			"column `{}` type `{}` does not match dictionary `{}` value type `{}`",
			column, column_type, dictionary, dictionary_value_type
		),
		fragment,
		label: Some("type mismatch".to_string()),
		help: Some(format!(
			"change the column type to `{}` to match the dictionary value type",
			dictionary_value_type
		)),
		column: None,
		notes: vec![],
		cause: None,
		operator_chain: None,
	}
}

pub fn table_column_already_exists(fragment: Fragment, namespace: &str, table: &str, column: &str) -> Diagnostic {
	Diagnostic {
		code: "CA_005".to_string(),
		rql: None,
		message: format!("column `{}` already exists in table `{}::{}`", column, namespace, table),
		fragment,
		label: Some("duplicate column definition".to_string()),
		help: Some("choose a different column name or drop the existing one first".to_string()),
		column: None,
		notes: vec![],
		cause: None,
		operator_chain: None,
	}
}

pub fn view_not_found(fragment: Fragment, namespace: &str, view: &str) -> Diagnostic {
	Diagnostic {
		code: "CA_004".to_string(),
		rql: None,
		message: format!("view `{}::{}` not found", namespace, view),
		fragment,
		label: Some("unknown view reference".to_string()),
		help: Some("ensure the view exists or create it first using `CREATE VIEW`".to_string()),
		column: None,
		notes: vec![],
		cause: None,
		operator_chain: None,
	}
}

pub fn procedure_not_found(fragment: Fragment, namespace: &str, procedure: &str) -> Diagnostic {
	Diagnostic {
		code: "CA_082".to_string(),
		rql: None,
		message: format!("procedure `{}::{}` not found", namespace, procedure),
		fragment,
		label: Some("unknown procedure reference".to_string()),
		help: Some("ensure the procedure exists or create it first using `CREATE PROCEDURE`".to_string()),
		column: None,
		notes: vec![],
		cause: None,
		operator_chain: None,
	}
}

pub fn view_column_already_exists(fragment: Fragment, namespace: &str, view: &str, column: &str) -> Diagnostic {
	Diagnostic {
		code: "CA_005".to_string(),
		rql: None,
		message: format!("column `{}` already exists in view `{}::{}`", column, namespace, view),
		fragment,
		label: Some("duplicate column definition".to_string()),
		help: Some("choose a different column name or drop the existing one first".to_string()),
		column: None,
		notes: vec![],
		cause: None,
		operator_chain: None,
	}
}

pub fn auto_increment_invalid_type(fragment: Fragment, column: &str, ty: Type) -> Diagnostic {
	Diagnostic {
		code: "CA_006".to_string(),
		rql: None,
		message: format!("auto increment is not supported for type `{}`", ty),
		fragment,
		label: Some("invalid auto increment usage".to_string()),
		help: Some(format!(
			"auto increment is only supported for integer types (int1-16, uint1-16), column `{}` has type `{}`",
			column, ty
		)),
		column: None,
		notes: vec![],
		cause: None,
		operator_chain: None,
	}
}

pub fn table_column_property_already_exists(policy: &str, column: &str) -> Diagnostic {
	Diagnostic {
		code: "CA_008".to_string(),
		rql: None,
		message: format!("policy `{policy:?}` already exists for column `{}`", column),
		fragment: Fragment::None,
		label: Some("duplicate column policy".to_string()),
		help: Some("remove the existing policy first".to_string()),
		column: None,
		notes: vec![],
		cause: None,
		operator_chain: None,
	}
}

pub fn index_variable_length_not_supported() -> Diagnostic {
	Diagnostic {
		code: "CA_009".to_string(),
		rql: None,
		message: "variable-length types (UTF8, BLOB) are not supported in indexes".to_string(),
		fragment: Fragment::None,
		label: Some("unsupported type for indexing".to_string()),
		help: Some("only fixed-size types can be indexed currently".to_string()),
		column: None,
		notes: vec![],
		cause: None,
		operator_chain: None,
	}
}

pub fn index_types_directions_mismatch(types_len: usize, directions_len: usize) -> Diagnostic {
	Diagnostic {
		code: "CA_010".to_string(),
		rql: None,
		message: format!(
			"mismatch between number of types ({}) and directions ({})",
			types_len, directions_len
		),
		fragment: Fragment::None,
		label: Some("length mismatch".to_string()),
		help: Some("each indexed field must have a corresponding sort direction".to_string()),
		column: None,
		notes: vec![],
		cause: None,
		operator_chain: None,
	}
}

pub fn namespace_already_pending_in_transaction(namespace_name: Fragment) -> Diagnostic {
	let fragment = namespace_name;
	let name = fragment.text();
	Diagnostic {
		code: "CA_011".to_string(),
		rql: None,
		message: format!("namespace `{}` already has pending changes in this transaction", name),
		fragment,
		label: Some("duplicate namespace modification in transaction".to_string()),
		help: Some("a namespace can only be created, updated, or deleted once per transaction".to_string()),
		column: None,
		notes: vec![
			"This usually indicates a programming error in transaction management".to_string(),
			"Consider reviewing the transaction logic for duplicate operations".to_string(),
		],
		cause: None,
		operator_chain: None,
	}
}

pub fn table_already_pending_in_transaction(namespace_name: Fragment, table_name: Fragment) -> Diagnostic {
	let namespace_fragment = namespace_name;
	let table_fragment = table_name;
	let namespace = namespace_fragment.text();
	let table = table_fragment.text();
	Diagnostic {
		code: "CA_012".to_string(),
		rql: None,
		message: format!("table `{}::{}` already has pending changes in this transaction", namespace, table),
		fragment: table_fragment,
		label: Some("duplicate table modification in transaction".to_string()),
		help: Some("a table can only be created, updated, or deleted once per transaction".to_string()),
		column: None,
		notes: vec![
			"This usually indicates a programming error in transaction management".to_string(),
			"Consider reviewing the transaction logic for duplicate operations".to_string(),
		],
		cause: None,
		operator_chain: None,
	}
}

pub fn view_already_pending_in_transaction(namespace_name: Fragment, view_name: Fragment) -> Diagnostic {
	let namespace_fragment = namespace_name;
	let view_fragment = view_name;
	let namespace = namespace_fragment.text();
	let view = view_fragment.text();
	Diagnostic {
		code: "CA_013".to_string(),
		rql: None,
		message: format!("view `{}::{}` already has pending changes in this transaction", namespace, view),
		fragment: view_fragment,
		label: Some("duplicate view modification in transaction".to_string()),
		help: Some("a view can only be created, updated, or deleted once per transaction".to_string()),
		column: None,
		notes: vec![
			"This usually indicates a programming error in transaction management".to_string(),
			"Consider reviewing the transaction logic for duplicate operations".to_string(),
		],
		cause: None,
		operator_chain: None,
	}
}

pub fn cannot_update_deleted_namespace(namespace_name: Fragment) -> Diagnostic {
	let fragment = namespace_name;
	let name = fragment.text();
	Diagnostic {
		code: "CA_014".to_string(),
		rql: None,
		message: format!("cannot update namespace `{}` as it is marked for deletion in this transaction", name),
		fragment,
		label: Some("attempted update on deleted namespace".to_string()),
		help: Some("remove the delete operation or skip the update".to_string()),
		column: None,
		notes: vec!["A namespace marked for deletion cannot be updated in the same transaction".to_string()],
		cause: None,
		operator_chain: None,
	}
}

pub fn cannot_update_deleted_table(namespace_name: Fragment, table_name: Fragment) -> Diagnostic {
	let namespace_fragment = namespace_name;
	let table_fragment = table_name;
	let namespace = namespace_fragment.text();
	let table = table_fragment.text();
	Diagnostic {
		code: "CA_015".to_string(),
		rql: None,
		message: format!(
			"cannot update table `{}::{}` as it is marked for deletion in this transaction",
			namespace, table
		),
		fragment: table_fragment,
		label: Some("attempted update on deleted table".to_string()),
		help: Some("remove the delete operation or skip the update".to_string()),
		column: None,
		notes: vec!["A table marked for deletion cannot be updated in the same transaction".to_string()],
		cause: None,
		operator_chain: None,
	}
}

pub fn cannot_update_deleted_view(namespace_name: Fragment, view_name: Fragment) -> Diagnostic {
	let namespace_fragment = namespace_name;
	let view_fragment = view_name;
	let namespace = namespace_fragment.text();
	let view = view_fragment.text();
	Diagnostic {
		code: "CA_016".to_string(),
		rql: None,
		message: format!(
			"cannot update view `{}::{}` as it is marked for deletion in this transaction",
			namespace, view
		),
		fragment: view_fragment,
		label: Some("attempted update on deleted view".to_string()),
		help: Some("remove the delete operation or skip the update".to_string()),
		column: None,
		notes: vec!["A view marked for deletion cannot be updated in the same transaction".to_string()],
		cause: None,
		operator_chain: None,
	}
}

pub fn cannot_delete_already_deleted_namespace(namespace_name: Fragment) -> Diagnostic {
	let fragment = namespace_name;
	let name = fragment.text();
	Diagnostic {
		code: "CA_017".to_string(),
		rql: None,
		message: format!("namespace `{}` is already marked for deletion in this transaction", name),
		fragment,
		label: Some("duplicate namespace deletion".to_string()),
		help: Some("remove the duplicate delete operation".to_string()),
		column: None,
		notes: vec!["A namespace can only be deleted once per transaction".to_string()],
		cause: None,
		operator_chain: None,
	}
}

pub fn cannot_delete_already_deleted_table(namespace_name: Fragment, table_name: Fragment) -> Diagnostic {
	let namespace_fragment = namespace_name;
	let table_fragment = table_name;
	let namespace = namespace_fragment.text();
	let table = table_fragment.text();
	Diagnostic {
		code: "CA_018".to_string(),
		rql: None,
		message: format!("table `{}::{}` is already marked for deletion in this transaction", namespace, table),
		fragment: table_fragment,
		label: Some("duplicate table deletion".to_string()),
		help: Some("remove the duplicate delete operation".to_string()),
		column: None,
		notes: vec!["A table can only be deleted once per transaction".to_string()],
		cause: None,
		operator_chain: None,
	}
}

pub fn cannot_delete_already_deleted_view(namespace_name: Fragment, view_name: Fragment) -> Diagnostic {
	let namespace_fragment = namespace_name;
	let view_fragment = view_name;
	let namespace = namespace_fragment.text();
	let view = view_fragment.text();
	Diagnostic {
		code: "CA_019".to_string(),
		rql: None,
		message: format!("view `{}::{}` is already marked for deletion in this transaction", namespace, view),
		fragment: view_fragment,
		label: Some("duplicate view deletion".to_string()),
		help: Some("remove the duplicate delete operation".to_string()),
		column: None,
		notes: vec!["A view can only be deleted once per transaction".to_string()],
		cause: None,
		operator_chain: None,
	}
}

pub fn primary_key_empty(fragment: Fragment) -> Diagnostic {
	Diagnostic {
		code: "CA_020".to_string(),
		rql: None,
		message: "primary key must contain at least one column".to_string(),
		fragment,
		label: Some("empty primary key definition".to_string()),
		help: Some("specify at least one column for the primary key".to_string()),
		column: None,
		notes: vec![],
		cause: None,
		operator_chain: None,
	}
}

pub fn primary_key_column_not_found(fragment: Fragment, column_id: u64) -> Diagnostic {
	Diagnostic {
		code: "CA_021".to_string(),
		rql: None,
		message: format!("column with ID {} not found for primary key", column_id),
		fragment,
		label: Some("invalid column reference in primary key".to_string()),
		help: Some("ensure all columns referenced in the primary key exist in the table or view".to_string()),
		column: None,
		notes: vec![],
		cause: None,
		operator_chain: None,
	}
}

pub fn virtual_table_already_exists(namespace: &str, name: &str) -> Diagnostic {
	Diagnostic {
		code: "CA_022".to_string(),
		rql: None,
		message: format!("virtual table `{}::{}` already exists", namespace, name),
		fragment: Fragment::None,
		label: Some("duplicate virtual table definition".to_string()),
		help: Some("choose a different name or unregister the existing virtual table first".to_string()),
		column: None,
		notes: vec![],
		cause: None,
		operator_chain: None,
	}
}

pub fn virtual_table_not_found(namespace: &str, name: &str) -> Diagnostic {
	Diagnostic {
		code: "CA_023".to_string(),
		rql: None,
		message: format!("virtual table `{}::{}` not found", namespace, name),
		fragment: Fragment::None,
		label: Some("unknown virtual table reference".to_string()),
		help: Some("ensure the virtual table is registered before using it".to_string()),
		column: None,
		notes: vec![],
		cause: None,
		operator_chain: None,
	}
}

pub fn subscription_already_exists(fragment: Fragment, subscription: &str) -> Diagnostic {
	Diagnostic {
		code: "CA_010".to_string(),
		rql: None,
		message: format!("subscription `{}` already exists", subscription),
		fragment,
		label: Some("duplicate subscription definition".to_string()),
		help: Some("choose a different name or close the existing subscription first".to_string()),
		column: None,
		notes: vec![],
		cause: None,
		operator_chain: None,
	}
}

pub fn subscription_not_found(fragment: Fragment, subscription: &str) -> Diagnostic {
	Diagnostic {
		code: "CA_011".to_string(),
		rql: None,
		message: format!("subscription `{}` not found", subscription),
		fragment,
		label: Some("unknown subscription reference".to_string()),
		help: Some("ensure the subscription exists or create it first using `CREATE SUBSCRIPTION`".to_string()),
		column: None,
		notes: vec![],
		cause: None,
		operator_chain: None,
	}
}

pub fn series_not_found(fragment: Fragment, namespace: &str, series: &str) -> Diagnostic {
	Diagnostic {
		code: "CA_024".to_string(),
		rql: None,
		message: format!("series `{}.{}` not found", namespace, series),
		fragment,
		label: Some("unknown series reference".to_string()),
		help: Some("ensure the series exists or create it first using `CREATE SERIES`".to_string()),
		column: None,
		notes: vec![],
		cause: None,
		operator_chain: None,
	}
}

pub fn handler_not_found(fragment: Fragment, namespace: &str, handler: &str) -> Diagnostic {
	Diagnostic {
		code: "CA_083".to_string(),
		rql: None,
		message: format!("handler `{}::{}` not found", namespace, handler),
		fragment,
		label: Some("unknown handler reference".to_string()),
		help: Some("ensure the handler exists or create it first using `CREATE HANDLER`".to_string()),
		column: None,
		notes: vec![],
		cause: None,
		operator_chain: None,
	}
}

pub fn test_not_found(fragment: Fragment, namespace: &str, test: &str) -> Diagnostic {
	Diagnostic {
		code: "CA_084".to_string(),
		rql: None,
		message: format!("test `{}::{}` not found", namespace, test),
		fragment,
		label: Some("unknown test reference".to_string()),
		help: Some("ensure the test exists or create it first using `CREATE TEST`".to_string()),
		column: None,
		notes: vec![],
		cause: None,
		operator_chain: None,
	}
}