Commit 29da4d2
fix!: enforce the backend/SQLGetInfo split with a test
Every item in the last three rounds was found by reading default_get_info
by hand and asking whether core had any business knowing the value. That
does not scale and it kept missing things. Replace the audit with a test.
default_get_info_answers_are_backend_derived_or_declared_core_facts
evaluates default_get_info for two mock backends that share no capability
declaration, and asks one question of every info type: does the answer
move when the backend does? An info type answering identically for both
is one core decided, and must appear in the test's CORE_FACTS list with
the reason core is entitled to decide it -- a fact about core's own
implementation (its fetch really is forward-only, the Backend trait
really is synchronous), a limit where the spec defines 0 as "no limit or
unknown", or driver identity with no per-backend answer. Hard-coding a
claim about the data source now fails a test that names the info type.
A second test asserts the two mocks differ in every hook, since the
classification is only as strong as that.
Running it surfaced what the hand audit had left:
- SQL_SUBQUERIES, SQL_COLUMN_ALIAS and SQL_CONCAT_NULL_BEHAVIOR are the
other half of the conformance contradiction fixed in 5f797be. The spec
names all three as values a SQL-92 Entry level-conformant driver
returns and core hard-coded exactly those, so a backend declaring no
conformance level was still reported as supporting correlated
subqueries, quantified predicates and column aliases. SQL_SUBQUERIES is
the one applications act on: claiming SQL_SQ_CORRELATED_SUBQUERIES for
a source without them is how a BI tool pushes down SQL the server
rejects. SQL_CONCAT_NULL_BEHAVIOR was also a bare 0 literal for a
spec-named constant; SQL_CB_NULL and SQL_CB_NON_NULL now exist.
- SQL_UNION, SQL_CONVERT_FUNCTIONS, SQL_ORDER_BY_COLUMNS_IN_SELECT,
SQL_ACCESSIBLE_TABLES, SQL_DATA_SOURCE_READ_ONLY and
SQL_SEARCH_PATTERN_ESCAPE were all statements about the data source
core had no way to know. SQL_ACCESSIBLE_TABLES was the sharpest: "Y"
guarantees the connected user has SELECT on every table SQLTables
returns, which depends on the principal, not the driver.
- SQL_IDENTIFIER_QUOTE_CHAR is now derived from
EscapeDialect::identifier_quotes instead of hard-coded to `"`. The
escape translator already consulted the dialect, so a backend quoting
with a backtick had core telling applications something the translator
contradicted. No new hook -- the fact was already declared, which is
the better fix and is now written into AGENTS.md as a rule.
BREAKING CHANGE: Backend gains required methods subqueries, column_alias,
concat_null_behavior, union_support, convert_functions,
order_by_columns_in_select, accessible_tables, data_source_read_only and
search_pattern_escape.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 886007b commit 29da4d2
5 files changed
Lines changed: 618 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
221 | 221 | | |
222 | 222 | | |
223 | 223 | | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
224 | 233 | | |
225 | 234 | | |
226 | 235 | | |
| |||
251 | 260 | | |
252 | 261 | | |
253 | 262 | | |
254 | | - | |
255 | | - | |
256 | | - | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
257 | 267 | | |
258 | | - | |
259 | | - | |
| 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 | + | |
260 | 294 | | |
261 | 295 | | |
262 | 296 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
38 | 47 | | |
39 | 48 | | |
40 | 49 | | |
| |||
96 | 105 | | |
97 | 106 | | |
98 | 107 | | |
99 | | - | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
100 | 112 | | |
101 | 113 | | |
102 | 114 | | |
| |||
151 | 163 | | |
152 | 164 | | |
153 | 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 | + | |
154 | 190 | | |
155 | 191 | | |
156 | 192 | | |
| |||
0 commit comments