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
// Copyright (C) 2026 Gabriel Shea
// Licensed under either of the Apache License, Version 2.0 or the MIT
// license, at your option.
//! **Which routine grammar this engine speaks** — the dialect's answer, not a
//! core crate's guess about its name.
//!
//! A stored procedure, a scalar function and a table function are the three
//! places where an engine's SQL stops resembling every other engine's. Razeri
//! composes the routine's *content* — its parameters, its body, its comment —
//! and asks the dialect which grammar to spell it in.
//!
//! All three enums are `#[non_exhaustive]`: Razeri adds a form when it has
//! measured one, and a dialect must state a fallback rather than assume the
//! list it compiled against is the list that ships.
//!
//! # If none of these is your engine
//!
//! Pick the closest measured form and *run the result* — the near-neighbour
//! trap is real, and a form that almost fits fails at `CREATE`, not at review.
//! If nothing fits, [`ProcedureForm::Unsupported`] and
//! [`TableFunctionForm::Unsupported`] carry your own words, and those words are
//! what the author reads instead of another engine's.
/// Which stored-procedure grammar this engine speaks.
///
/// The default is [`ProcedureForm::Agnostic`], Razeri's own annotated form. It
/// parses nowhere: it is the honest answer for a dialect that has not said, and
/// the conformance kit reports it as an unanswered obligation.
/// Which scalar-function grammar this engine speaks.
///
/// The default is [`ScalarFunctionForm::PostgreSql`], which is what an
/// unlisted dialect has always been handed. It is a guess and a dangerous one
/// on a near neighbour: `LANGUAGE SQL IMMUTABLE PARALLEL SAFE` is a *"syntax
/// error at or near `PARALLEL`"* on `Redshift`, an engine that descends from
/// `PostgreSQL` and reports itself as one. State your form.
/// Which **table-valued function** grammar this engine speaks — the routine a
/// query selects `FROM`, returning columns rather than one value.
///
/// The default is [`TableFunctionForm::PostgreSql`], which is what an unlisted
/// dialect has always been handed. Four engines in Razeri's own set have no
/// table-valued function they can render, and each says so in **its own words**
/// through [`TableFunctionForm::Unsupported`] — because a refusal written once
/// per *kind* tells a `Redshift` author about `MySQL`, and the sentence that
/// helps is the one about their engine.