forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitce1e7a2
committed
Don't let libpq "event" procs break the state of PGresult objects.
As currently implemented, failure of a PGEVT_RESULTCREATE callbackcauses the PGresult to be converted to an error result. This isintellectually inconsistent (shouldn't a failing callback likewiseprevent creation of the error result? what about side-effects on thebehavior seen by other event procs? why does PQfireResultCreateEventsact differently from PQgetResult?), but more importantly it destroysany promises we might wish to make about the behavior of libpq innontrivial operating modes, such as pipeline mode. For example,it's not possible to promise that PGRES_PIPELINE_SYNC results willbe returned if an event callback fails on those. With thisdefinition, expecting applications to behave sanely in the face ofpossibly-failing callbacks seems like a very big lift.Hence, redefine the result of a callback failure as being simplythat that event procedure won't be called any more for this PGresult(which was true already). Event procedures can still signal failureback to the application through out-of-band mechanisms, for examplevia their passthrough arguments.Similarly, don't let failure of a PGEVT_RESULTCOPY callback preventPQcopyResult from succeeding. That definition allowed a misbehavingevent proc to break single-row mode (our sole internal use ofPQcopyResult), and it probably had equally deleterious effects foroutside uses.Discussion:https://postgr.es/m/3185105.1644960083@sss.pgh.pa.us1 parentde447bb commitce1e7a2
File tree
3 files changed
+31
-51
lines changed- doc/src/sgml
- src/interfaces/libpq
3 files changed
+31
-51
lines changedLines changed: 16 additions & 15 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
6831 | 6831 |
| |
6832 | 6832 |
| |
6833 | 6833 |
| |
| 6834 | + | |
6834 | 6835 |
| |
6835 | 6836 |
| |
6836 | 6837 |
| |
| |||
7126 | 7127 |
| |
7127 | 7128 |
| |
7128 | 7129 |
| |
7129 |
| - | |
| 7130 | + | |
7130 | 7131 |
| |
7131 | 7132 |
| |
7132 | 7133 |
| |
| |||
7154 | 7155 |
| |
7155 | 7156 |
| |
7156 | 7157 |
| |
7157 |
| - | |
| 7158 | + | |
7158 | 7159 |
| |
7159 | 7160 |
| |
7160 | 7161 |
| |
| |||
7261 | 7262 |
| |
7262 | 7263 |
| |
7263 | 7264 |
| |
7264 |
| - | |
7265 |
| - | |
7266 |
| - | |
7267 |
| - | |
7268 |
| - | |
| 7265 | + | |
| 7266 | + | |
| 7267 | + | |
| 7268 | + | |
| 7269 | + | |
7269 | 7270 |
| |
7270 | 7271 |
| |
7271 | 7272 |
| |
| |||
7295 | 7296 |
| |
7296 | 7297 |
| |
7297 | 7298 |
| |
7298 |
| - | |
7299 |
| - | |
7300 |
| - | |
7301 |
| - | |
7302 |
| - | |
7303 |
| - | |
| 7299 | + | |
| 7300 | + | |
| 7301 | + | |
| 7302 | + | |
| 7303 | + | |
| 7304 | + | |
7304 | 7305 |
| |
7305 | 7306 |
| |
7306 | 7307 |
| |
| |||
7618 | 7619 |
| |
7619 | 7620 |
| |
7620 | 7621 |
| |
7621 |
| - | |
| 7622 | + | |
7622 | 7623 |
| |
7623 | 7624 |
| |
7624 | 7625 |
| |
| |||
7629 | 7630 |
| |
7630 | 7631 |
| |
7631 | 7632 |
| |
7632 |
| - | |
| 7633 | + | |
7633 | 7634 |
| |
7634 | 7635 |
| |
7635 | 7636 |
| |
|
Lines changed: 7 additions & 30 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
363 | 363 |
| |
364 | 364 |
| |
365 | 365 |
| |
| 366 | + | |
366 | 367 |
| |
367 | 368 |
| |
368 | 369 |
| |
369 | 370 |
| |
370 | 371 |
| |
371 | 372 |
| |
372 |
| - | |
373 |
| - | |
374 |
| - | |
375 |
| - | |
376 |
| - | |
377 |
| - | |
378 |
| - | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
379 | 376 |
| |
380 | 377 |
| |
381 | 378 |
| |
| |||
2124 | 2121 |
| |
2125 | 2122 |
| |
2126 | 2123 |
| |
2127 |
| - | |
2128 |
| - | |
2129 |
| - | |
2130 |
| - | |
2131 |
| - | |
2132 |
| - | |
2133 |
| - | |
2134 |
| - | |
2135 |
| - | |
2136 |
| - | |
2137 |
| - | |
2138 |
| - | |
2139 |
| - | |
2140 |
| - | |
2141 |
| - | |
2142 |
| - | |
2143 |
| - | |
2144 |
| - | |
2145 |
| - | |
2146 |
| - | |
2147 |
| - | |
2148 |
| - | |
2149 |
| - | |
| 2124 | + | |
| 2125 | + | |
| 2126 | + | |
2150 | 2127 |
| |
2151 | 2128 |
| |
2152 | 2129 |
| |
|
Lines changed: 8 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
184 | 184 |
| |
185 | 185 |
| |
186 | 186 |
| |
| 187 | + | |
187 | 188 |
| |
188 | 189 |
| |
189 | 190 |
| |
190 | 191 |
| |
191 | 192 |
| |
192 | 193 |
| |
193 | 194 |
| |
| 195 | + | |
194 | 196 |
| |
195 | 197 |
| |
196 | 198 |
| |
197 | 199 |
| |
198 | 200 |
| |
199 | 201 |
| |
200 |
| - | |
201 |
| - | |
202 |
| - | |
203 |
| - | |
204 |
| - | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
205 | 207 |
| |
206 | 208 |
| |
207 | 209 |
| |
208 |
| - | |
| 210 | + | |
209 | 211 |
|
0 commit comments
Comments
(0)