forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit5b8728c
committed
Fix NULLIF()'s handling of read-write expanded objects.
If passed a read-write expanded object pointer, the EEOP_NULLIFcode would hand that same pointer to the equality functionand then (unless equality was reported) also return the samepointer as its value. This is no good, because a function thatreceives a read-write expanded object pointer is fully entitledto scribble on or even delete the object, thus corrupting theNULLIF output. (This problem is likely unobservable with theequality functions provided in core Postgres, but it's easy todemonstrate with one coded in plpgsql.)To fix, make sure the pointer passed to the equality functionis read-only. We can still return the original read-writepointer as the NULLIF result, allowing optimization of lateroperations.Per bug #18722 from Alexander Lakhin. This has been wrongsince we invented expanded objects, so back-patch to allsupported branches.Discussion:https://postgr.es/m/18722-fd9e645448cc78b4@postgresql.org1 parent4ba84de commit5b8728c
File tree
6 files changed
+64
-5
lines changed- src
- backend
- executor
- jit/llvm
- include/executor
- test/regress
- expected
- sql
6 files changed
+64
-5
lines changedLines changed: 8 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1191 | 1191 |
| |
1192 | 1192 |
| |
1193 | 1193 |
| |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
1194 | 1202 |
| |
1195 | 1203 |
| |
1196 | 1204 |
| |
|
Lines changed: 13 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1308 | 1308 |
| |
1309 | 1309 |
| |
1310 | 1310 |
| |
| 1311 | + | |
1311 | 1312 |
| |
1312 | 1313 |
| |
1313 | 1314 |
| |
1314 | 1315 |
| |
1315 | 1316 |
| |
1316 | 1317 |
| |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
1317 | 1329 |
| |
1318 | 1330 |
| |
1319 | 1331 |
| |
| |||
1328 | 1340 |
| |
1329 | 1341 |
| |
1330 | 1342 |
| |
1331 |
| - | |
| 1343 | + | |
1332 | 1344 |
| |
1333 | 1345 |
| |
1334 | 1346 |
| |
|
Lines changed: 29 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1559 | 1559 |
| |
1560 | 1560 |
| |
1561 | 1561 |
| |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
1562 | 1565 |
| |
1563 | 1566 |
| |
1564 | 1567 |
| |
| |||
1575 | 1578 |
| |
1576 | 1579 |
| |
1577 | 1580 |
| |
1578 |
| - | |
1579 | 1581 |
| |
1580 | 1582 |
| |
1581 | 1583 |
| |
1582 | 1584 |
| |
1583 | 1585 |
| |
1584 | 1586 |
| |
1585 | 1587 |
| |
| 1588 | + | |
| 1589 | + | |
| 1590 | + | |
| 1591 | + | |
| 1592 | + | |
| 1593 | + | |
| 1594 | + | |
| 1595 | + | |
| 1596 | + | |
| 1597 | + | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
1586 | 1611 |
| |
1587 | 1612 |
| |
1588 | 1613 |
| |
1589 |
| - | |
1590 |
| - | |
1591 |
| - | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
1592 | 1617 |
| |
1593 | 1618 |
| |
1594 | 1619 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
365 | 365 |
| |
366 | 366 |
| |
367 | 367 |
| |
| 368 | + | |
368 | 369 |
| |
369 | 370 |
| |
370 | 371 |
| |
|
Lines changed: 8 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
397 | 397 |
| |
398 | 398 |
| |
399 | 399 |
| |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
400 | 408 |
| |
401 | 409 |
| |
402 | 410 |
| |
|
Lines changed: 5 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
242 | 242 |
| |
243 | 243 |
| |
244 | 244 |
| |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
245 | 250 |
| |
246 | 251 |
| |
247 | 252 |
| |
|
0 commit comments
Comments
(0)