forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit4c2369a
committed
Fix incorrect pruning of NULL partition for boolean IS NOT clauses
Partition pruning wrongly assumed that, for a table partitioned on aboolean column, a clause in the form "boolcol IS NOT false" and "boolcolIS NOT true" could be inverted to correspondingly become "boolcol IS true"and "boolcol IS false". These are not equivalent as the NOT versionmatches the opposite boolean value *and* NULLs. This incorrect assumptionmeant that partition pruning pruned away partitions that could containNULL values.Here we fix this by correctly not pruning partitions which could storeNULLs.To be affected by this, the table must be partitioned by a NULLable booleancolumn and queries would have to contain "boolcol IS NOT false" or "boolcolIS NOT true". This could result in queries filtering out NULL valueswith a LIST partitioned table and "ERROR: invalid strategy number 0"for RANGE and HASH partitioned tables.Reported-by: Alexander LakhinBug: #18344Discussion:https://postgr.es/m/18344-8d3f00bada6d09c6@postgresql.orgBackpatch-through: 121 parent0e16281 commit4c2369a
File tree
3 files changed
+187
-2
lines changed- src
- backend/partitioning
- test/regress
- expected
- sql
3 files changed
+187
-2
lines changedLines changed: 54 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1810 | 1810 |
| |
1811 | 1811 |
| |
1812 | 1812 |
| |
| 1813 | + | |
| 1814 | + | |
| 1815 | + | |
| 1816 | + | |
| 1817 | + | |
| 1818 | + | |
| 1819 | + | |
| 1820 | + | |
| 1821 | + | |
| 1822 | + | |
| 1823 | + | |
| 1824 | + | |
| 1825 | + | |
| 1826 | + | |
| 1827 | + | |
| 1828 | + | |
| 1829 | + | |
| 1830 | + | |
| 1831 | + | |
| 1832 | + | |
| 1833 | + | |
| 1834 | + | |
| 1835 | + | |
| 1836 | + | |
| 1837 | + | |
| 1838 | + | |
| 1839 | + | |
| 1840 | + | |
| 1841 | + | |
| 1842 | + | |
| 1843 | + | |
| 1844 | + | |
| 1845 | + | |
| 1846 | + | |
| 1847 | + | |
| 1848 | + | |
| 1849 | + | |
| 1850 | + | |
| 1851 | + | |
| 1852 | + | |
| 1853 | + | |
| 1854 | + | |
| 1855 | + | |
| 1856 | + | |
| 1857 | + | |
| 1858 | + | |
| 1859 | + | |
| 1860 | + | |
| 1861 | + | |
| 1862 | + | |
| 1863 | + | |
| 1864 | + | |
1813 | 1865 |
| |
1814 | 1866 |
| |
1815 | 1867 |
| |
1816 | 1868 |
| |
1817 |
| - | |
| 1869 | + | |
1818 | 1870 |
| |
1819 | 1871 |
| |
1820 | 1872 |
| |
| |||
2358 | 2410 |
| |
2359 | 2411 |
| |
2360 | 2412 |
| |
2361 |
| - | |
| 2413 | + | |
2362 | 2414 |
| |
2363 | 2415 |
| |
2364 | 2416 |
| |
|
Lines changed: 103 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1169 | 1169 |
| |
1170 | 1170 |
| |
1171 | 1171 |
| |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
1172 | 1223 |
| |
1173 | 1224 |
| |
1174 | 1225 |
| |
| |||
1315 | 1366 |
| |
1316 | 1367 |
| |
1317 | 1368 |
| |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
1318 | 1394 |
| |
1319 | 1395 |
| |
1320 | 1396 |
| |
1321 | 1397 |
| |
1322 | 1398 |
| |
| 1399 | + | |
1323 | 1400 |
| |
1324 | 1401 |
| |
1325 | 1402 |
| |
| |||
1328 | 1405 |
| |
1329 | 1406 |
| |
1330 | 1407 |
| |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
1331 | 1434 |
| |
1332 | 1435 |
| |
1333 | 1436 |
| |
|
Lines changed: 30 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
178 | 178 |
| |
179 | 179 |
| |
180 | 180 |
| |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
181 | 194 |
| |
182 | 195 |
| |
183 | 196 |
| |
| |||
204 | 217 |
| |
205 | 218 |
| |
206 | 219 |
| |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
207 | 230 |
| |
208 | 231 |
| |
209 | 232 |
| |
210 | 233 |
| |
211 | 234 |
| |
| 235 | + | |
212 | 236 |
| |
213 | 237 |
| |
214 | 238 |
| |
215 | 239 |
| |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
216 | 246 |
| |
217 | 247 |
| |
218 | 248 |
| |
|
0 commit comments
Comments
(0)