Repository navigation
Commit c8742c6
fix(db): run SQL on a parameterless DBAPI cursor —
`execute_readonly` went through `exec_driver_sql`, which hands the driver an
(empty) parameter set. psycopg speaks pyformat, so it then scanned the statement
for placeholders and rejected `LIKE '%variance%'`:
only '%s', '%b', '%t' are allowed as placeholders, got '%v'
That is the single most common shape a text-to-SQL model emits, plus the `%`
modulo operator — and it hit BIRD's own gold SQL too, so affected questions
could not even be scored (qids 586/587 on the codebase_community eval). The
Postgres backend has been advertised since day one; nothing had ever actually
run a LIKE against it.
A DBAPI cursor executed with no parameters interprets nothing, which is the only
path that survives both traps at once: psycopg's `%` and SQLAlchemy `text()`'s
`:__` (the latter is why the code left `text()` in the first place — BIRD qids
959/989/990). Driver-native exceptions are re-wrapped into `sqlalchemy.exc` so
that callers' error classification (execution/runner.py) keeps working.
Live-Postgres tests pin LIKE (prefix/suffix/contains), the modulo operator, and
colon literals. SQLite path is unchanged: re-measured n=200 → still 57.5%.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>% broke every Postgres query1 parent 2ac852b commit c8742c6
2 files changed
Lines changed: 72 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
126 | 127 | | |
127 | 128 | | |
128 | 129 | | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
| 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 | + | |
136 | 160 | | |
137 | 161 | | |
138 | 162 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 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 | + | |
0 commit comments