forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit157f873
committed
Fix psql's single transaction mode on client-side errors with -c/-f switches
psql --single-transaction is able to handle multiple -c and -f switchesin a single transaction sinced5563d7, but this had the surprisingbehavior of forcing a transaction COMMIT even if psql failed with anerror in the client (for example incorrect path given to \copy), whichwould generate an error, but still commit any changes that were alreadyapplied in the backend. This commit makes the behavior more consistent,by enforcing a transaction ROLLBACK if any commands fail, bothclient-side and backend-side, so as no changes are applied if one errorhappens in any of them.Some tests are added on HEAD to provide some coverage about all that.Backend-side errors are unreliable as IPC::Run can complain on SIGPIPEif psql quits before reading a query result, but that should workproperly in the case where any errors come from psql itself, which iswhat the original report is about.Reported-by: Christoph BergAuthor: Kyotaro Horiguchi, Michael PaquierDiscussion:https://postgr.es/m/17504-76b68018e130415e@postgresql.orgBackpatch-through: 101 parentf00a4f0 commit157f873
File tree
3 files changed
+71
-3
lines changed- doc/src/sgml/ref
- src/bin/psql
- t
3 files changed
+71
-3
lines changedLines changed: 4 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
584 | 584 |
| |
585 | 585 |
| |
586 | 586 |
| |
587 |
| - | |
588 |
| - | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
589 | 591 |
| |
590 | 592 |
| |
591 | 593 |
| |
|
Lines changed: 3 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
426 | 426 |
| |
427 | 427 |
| |
428 | 428 |
| |
429 |
| - | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
430 | 432 |
| |
431 | 433 |
| |
432 | 434 |
| |
|
Lines changed: 64 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
198 | 198 |
| |
199 | 199 |
| |
200 | 200 |
| |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 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 | + | |
201 | 265 |
|
0 commit comments
Comments
(0)