forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitd2ef775
committed
Fix constant-folding of ROW(...) IS [NOT] NULL with composite fields.
The SQL standard appears to specify that IS [NOT] NULL's tests of fieldnullness are non-recursive, ie, we shouldn't consider that a compositefield with value ROW(NULL,NULL) is null for this purpose.ExecEvalNullTest got this right, but eval_const_expressions did not,leading to weird inconsistencies depending on whether the expressionwas such that the planner could apply constant folding.Also, adjust the docs to mention that IS [NOT] DISTINCT FROM NULL can beused as a substitute test if a simple null check is wanted for a rowtypeargument. That motivated reordering things so that IS [NOT] DISTINCT FROMis described before IS [NOT] NULL. In HEAD, I went a bit further and addeda table showing all the comparison-related predicates.Per bug #14235. Back-patch to all supported branches, since it's certainlyundesirable that constant-folding should change the semantics.Report and patch by Andrew Gierth; assorted wordsmithing and revisedregression test cases by me.Report: <20160708024746.1410.57282@wrigleys.postgresql.org>1 parentcf35406 commitd2ef775
File tree
5 files changed
+136
-40
lines changed- doc/src/sgml
- src
- backend
- executor
- optimizer/util
- test/regress
- expected
- sql
5 files changed
+136
-40
lines changedLines changed: 34 additions & 36 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
289 | 289 |
| |
290 | 290 |
| |
291 | 291 |
| |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
292 | 318 |
| |
293 | 319 |
| |
294 | 320 |
| |
| |||
320 | 346 |
| |
321 | 347 |
| |
322 | 348 |
| |
323 |
| - | |
324 |
| - | |
| 349 | + | |
325 | 350 |
| |
326 | 351 |
| |
327 | 352 |
| |
| |||
338 | 363 |
| |
339 | 364 |
| |
340 | 365 |
| |
341 |
| - | |
342 | 366 |
| |
343 | 367 |
| |
344 | 368 |
| |
345 | 369 |
| |
346 | 370 |
| |
347 | 371 |
| |
348 | 372 |
| |
349 |
| - | |
350 |
| - | |
351 |
| - | |
352 |
| - | |
353 |
| - | |
354 |
| - | |
355 |
| - | |
356 |
| - | |
357 |
| - | |
358 |
| - | |
359 |
| - | |
360 |
| - | |
361 |
| - | |
362 |
| - | |
363 |
| - | |
364 |
| - | |
365 |
| - | |
366 |
| - | |
367 |
| - | |
368 |
| - | |
369 |
| - | |
370 |
| - | |
371 |
| - | |
372 |
| - | |
373 |
| - | |
374 |
| - | |
375 |
| - | |
376 |
| - | |
377 |
| - | |
378 |
| - | |
379 |
| - | |
380 |
| - | |
381 |
| - | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
382 | 380 |
| |
383 | 381 |
| |
384 | 382 |
| |
|
Lines changed: 15 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3793 | 3793 |
| |
3794 | 3794 |
| |
3795 | 3795 |
| |
| 3796 | + | |
| 3797 | + | |
| 3798 | + | |
| 3799 | + | |
| 3800 | + | |
| 3801 | + | |
| 3802 | + | |
| 3803 | + | |
| 3804 | + | |
| 3805 | + | |
| 3806 | + | |
| 3807 | + | |
| 3808 | + | |
| 3809 | + | |
| 3810 | + | |
3796 | 3811 |
| |
3797 | 3812 |
| |
3798 | 3813 |
| |
|
Lines changed: 9 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3330 | 3330 |
| |
3331 | 3331 |
| |
3332 | 3332 |
| |
3333 |
| - | |
| 3333 | + | |
3334 | 3334 |
| |
3335 | 3335 |
| |
3336 | 3336 |
| |
| |||
3342 | 3342 |
| |
3343 | 3343 |
| |
3344 | 3344 |
| |
3345 |
| - | |
3346 |
| - | |
3347 | 3345 |
| |
3348 | 3346 |
| |
3349 | 3347 |
| |
| |||
3362 | 3360 |
| |
3363 | 3361 |
| |
3364 | 3362 |
| |
| 3363 | + | |
| 3364 | + | |
| 3365 | + | |
| 3366 | + | |
| 3367 | + | |
| 3368 | + | |
| 3369 | + | |
3365 | 3370 |
| |
3366 | 3371 |
| |
3367 | 3372 |
| |
3368 |
| - | |
| 3373 | + | |
3369 | 3374 |
| |
3370 | 3375 |
| |
3371 | 3376 |
| |
|
Lines changed: 54 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
657 | 657 |
| |
658 | 658 |
| |
659 | 659 |
| |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + |
Lines changed: 24 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
286 | 286 |
| |
287 | 287 |
| |
288 | 288 |
| |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + |
0 commit comments
Comments
(0)