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
//! What a relation predicate refuses with, whichever backend renders it: [`RelationWidthError`] and
//! [`RelationDepthError`].
//!
//! # The payloads are neutral where the ENUMS holding them are not
//!
//! [`SqlLoweringError`](super::sql::SqlLoweringError) and
//! [`MongoLoweringError`](super::mongo::MongoLoweringError) are two vocabularies, because what a
//! dialect can say no to is not what a document store can. These two causes are in BOTH, and they
//! carry the same three facts either way: a relation joins one column to one column whichever
//! language spells the join, and an alias table runs out at the same depth whichever engine indexes
//! it.
//!
//! So they sit here rather than once per family. Two structs of the same shape under two names would
//! be a caller converting between them to report one fact, and a message that could drift between
//! the backends for a reason neither of them has.
//!
//! They started in [`sql`](super::sql), which is where the first engine put them, and the second
//! backend is what moved them — the same road [`CrossingError`](crate::query::CrossingError) and
//! [`DEPTH_CEILING`](crate::query::DEPTH_CEILING) took. Both families re-export them, so every path
//! a reader already knows keeps resolving.
use crateFieldName;
/// The payload of a relation refused for its ADDRESS: the row addressed by several columns, and how
/// many address it.
///
/// A `ref` field carries `<Target as Identifiable>::Id`, and an id is ONE column because every
/// table's id is unique. So the forward semi-join has one name to project and the reverse
/// correlation one name to compare against, and a row addressed by two leaves the second side with
/// nothing to meet.
///
/// It names the row at fault rather than the relation, because that is what a caller changes: either
/// the [`RecordAddress`](crate::RecordAddress) the position was given is the wrong row, or the row
/// really is compound and the relation belongs on its id instead.
///
/// `Copy` with the enums that hold it, both halves being a `'static` name and a count.
/// The payload of a relation refused for its DEPTH: the row whose alias was asked for, the depth
/// asked, and how many depths its aliases were minted for.
///
/// A nested relation renames its scope per LEVEL — depth one inside depth zero, and so on — and a
/// row's alias table holds one name per level up to the depth its declaration minted, which is
/// [`DEPTH_CEILING`](crate::query::DEPTH_CEILING) unless `<db>(alias(depth = …))` named
/// another. Past the last entry there is no name left to take, and the alternative to refusing is
/// REUSING one — which is silent on both backends and silent in two different ways. SQL resolves a
/// reference to the innermost scope that has a match, so a repeated alias correlates the wrong two
/// rows and the statement still answers; a repeated MongoDB join field is written twice in one
/// document, so the second `$lookup` OVERWRITES the first and the predicate that reads it tests a
/// set nobody asked about.
///
/// The CEILING carried is the alias table's own length rather than the constant, so the message
/// cannot describe a row that was minted to a different depth — and that is what lets the depth BE a
/// declaration's choice: a row minted sixteen deep refuses at sixteen, saying sixteen, with no
/// engine anywhere holding a second copy of the number.
///
/// `Copy` with the enums that hold it — a `'static` name and two counts.