Commit 6a396d3
authored
feat: parse SET TRANSACTION statements (#549)
* feat: parse SET TRANSACTION statements
Parse SET TRANSACTION statements and translate these to SET LOCAL statements.
SET TRANSACTION may only be executed in a transaction block, and can only be
used for a specific, limited set of connection properties. The syntax is
specified by the SQL standard and PostgreSQL.
See also https://www.postgresql.org/docs/current/sql-set-transaction.html
This change only adds partial support. The following features will be added
in future changes:
1. SET TRANSACTION READ {WRITE | ONLY} is not picked up by the driver, as
the type of transaction is set directly when BeginTx is called. A
refactor of this transaction handling is needed to be able to pick up
SET TRANSACTION READ ONLY / SET TRANSACTION READ WRITE statements that
are executed after BeginTx has been called.
2. PostgreSQL allows multiple transaction modes to be set in a single
SET TRANSACTION statement. E.g. the following is allowed:
SET TRANSACTION READ WRITE, ISOLATION LEVEL SERIALIZABLE
The current implementation only supports one transaction mode per
SET statement.
* feat: support multiple transaction options in one statement1 parent 8893903 commit 6a396d3
File tree
9 files changed
+522
-59
lines changed- connectionstate
- parser
9 files changed
+522
-59
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
327 | 327 | | |
328 | 328 | | |
329 | 329 | | |
330 | | - | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
331 | 336 | | |
332 | 337 | | |
333 | 338 | | |
334 | 339 | | |
335 | 340 | | |
336 | | - | |
| 341 | + | |
337 | 342 | | |
338 | 343 | | |
339 | 344 | | |
| |||
1188 | 1193 | | |
1189 | 1194 | | |
1190 | 1195 | | |
| 1196 | + | |
| 1197 | + | |
1191 | 1198 | | |
1192 | 1199 | | |
1193 | 1200 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
228 | 228 | | |
229 | 229 | | |
230 | 230 | | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
231 | 249 | | |
232 | 250 | | |
233 | 251 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
134 | | - | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
135 | 138 | | |
136 | 139 | | |
137 | 140 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
290 | 290 | | |
291 | 291 | | |
292 | 292 | | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
293 | 303 | | |
294 | 304 | | |
295 | 305 | | |
| |||
323 | 333 | | |
324 | 334 | | |
325 | 335 | | |
326 | | - | |
327 | | - | |
| 336 | + | |
| 337 | + | |
328 | 338 | | |
329 | 339 | | |
330 | 340 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2135 | 2135 | | |
2136 | 2136 | | |
2137 | 2137 | | |
| 2138 | + | |
| 2139 | + | |
| 2140 | + | |
| 2141 | + | |
2138 | 2142 | | |
2139 | 2143 | | |
2140 | 2144 | | |
| |||
2404 | 2408 | | |
2405 | 2409 | | |
2406 | 2410 | | |
| 2411 | + | |
| 2412 | + | |
| 2413 | + | |
| 2414 | + | |
| 2415 | + | |
| 2416 | + | |
| 2417 | + | |
| 2418 | + | |
| 2419 | + | |
| 2420 | + | |
| 2421 | + | |
| 2422 | + | |
| 2423 | + | |
| 2424 | + | |
| 2425 | + | |
| 2426 | + | |
| 2427 | + | |
| 2428 | + | |
| 2429 | + | |
| 2430 | + | |
| 2431 | + | |
| 2432 | + | |
| 2433 | + | |
| 2434 | + | |
| 2435 | + | |
| 2436 | + | |
| 2437 | + | |
| 2438 | + | |
| 2439 | + | |
| 2440 | + | |
2407 | 2441 | | |
2408 | 2442 | | |
2409 | 2443 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
| |||
142 | 144 | | |
143 | 145 | | |
144 | 146 | | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
145 | 156 | | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
150 | 168 | | |
151 | 169 | | |
152 | 170 | | |
| |||
165 | 183 | | |
166 | 184 | | |
167 | 185 | | |
168 | | - | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
169 | 191 | | |
170 | 192 | | |
171 | 193 | | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
172 | 197 | | |
173 | 198 | | |
174 | 199 | | |
| |||
191 | 216 | | |
192 | 217 | | |
193 | 218 | | |
194 | | - | |
195 | | - | |
| 219 | + | |
| 220 | + | |
196 | 221 | | |
197 | 222 | | |
198 | 223 | | |
199 | 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 | + | |
200 | 306 | | |
201 | 307 | | |
202 | 308 | | |
| |||
404 | 510 | | |
405 | 511 | | |
406 | 512 | | |
| 513 | + | |
407 | 514 | | |
408 | 515 | | |
409 | 516 | | |
| |||
0 commit comments