forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commite04a390
committed
Improve planner's understanding of strictness of type coercions.
PG type coercions are generally strict, ie a NULL input must producea NULL output (or, in domain cases, possibly an error). The planner'sunderstanding of that was a bit incomplete though, so improve it:* Teach contain_nonstrict_functions() that CoerceViaIO can always beconsidered strict. Previously it believed that only if the underlyingI/O functions were marked strict, which is often but not always true.* Teach clause_is_strict_for() that CoerceViaIO, ArrayCoerceExpr,ConvertRowtypeExpr, CoerceToDomain can all be considered strict.Previously it knew nothing about any of them.The main user-visible impact of this is that IS NOT NULL predicatescan be proven to hold from expressions involving casts in more casesthan before, allowing partial indexes with such predicates to be usedwithout extra pushups. This reduces the surprise factor for users,who may well be used to ordinary (function-call-based) casts beingknown to be strict.Per a gripe from Samuel Williams. This doesn't rise to the level ofa bug, IMO, so no back-patch.Discussion:https://postgr.es/m/27571.1550617881@sss.pgh.pa.us1 parent1571bc0 commite04a390
2 files changed
+31
-0
lines changedLines changed: 10 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1172 | 1172 |
| |
1173 | 1173 |
| |
1174 | 1174 |
| |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
1175 | 1185 |
| |
1176 | 1186 |
| |
1177 | 1187 |
| |
|
Lines changed: 21 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1352 | 1352 |
| |
1353 | 1353 |
| |
1354 | 1354 |
| |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
1355 | 1376 |
| |
1356 | 1377 |
| |
1357 | 1378 |
| |
|
0 commit comments
Comments
(0)