Commit 080b7db
committed
Fix "cannot accept a set" error when only some arms of a CASE return a set.
In commit c135205, I implemented an
optimization that assumed that a function's argument expressions would
either always return a set (ie multiple rows), or always not. This is
wrong however: we allow CASE expressions in which some arms return a set
of some type and others just return a scalar of that type. There may be
other examples as well. To fix, replace the run-time test of whether an
argument returned a set with a static precheck (expression_returns_set).
This adds a little bit of query startup overhead, but it seems barely
measurable.
Per bug #8228 from David Johnston. This has been broken since 8.0,
so patch all supported branches.1 parent daa7527 commit 080b7db
File tree
3 files changed
+61
-17
lines changed- src
- backend/executor
- test/regress
- expected
- sql
3 files changed
+61
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1634 | 1634 | | |
1635 | 1635 | | |
1636 | 1636 | | |
1637 | | - | |
1638 | | - | |
1639 | | - | |
| 1637 | + | |
1640 | 1638 | | |
1641 | 1639 | | |
1642 | 1640 | | |
| |||
1906 | 1904 | | |
1907 | 1905 | | |
1908 | 1906 | | |
1909 | | - | |
1910 | | - | |
1911 | | - | |
1912 | | - | |
| 1907 | + | |
| 1908 | + | |
| 1909 | + | |
| 1910 | + | |
| 1911 | + | |
1913 | 1912 | | |
1914 | | - | |
1915 | | - | |
1916 | 1913 | | |
1917 | 1914 | | |
1918 | 1915 | | |
| |||
2371 | 2368 | | |
2372 | 2369 | | |
2373 | 2370 | | |
2374 | | - | |
2375 | | - | |
2376 | | - | |
2377 | | - | |
| 2371 | + | |
| 2372 | + | |
| 2373 | + | |
| 2374 | + | |
| 2375 | + | |
| 2376 | + | |
| 2377 | + | |
| 2378 | + | |
| 2379 | + | |
| 2380 | + | |
| 2381 | + | |
| 2382 | + | |
| 2383 | + | |
| 2384 | + | |
| 2385 | + | |
| 2386 | + | |
2378 | 2387 | | |
2379 | 2388 | | |
2380 | 2389 | | |
| |||
2394 | 2403 | | |
2395 | 2404 | | |
2396 | 2405 | | |
2397 | | - | |
2398 | | - | |
2399 | | - | |
2400 | | - | |
| 2406 | + | |
| 2407 | + | |
| 2408 | + | |
| 2409 | + | |
| 2410 | + | |
| 2411 | + | |
| 2412 | + | |
| 2413 | + | |
| 2414 | + | |
| 2415 | + | |
| 2416 | + | |
| 2417 | + | |
| 2418 | + | |
| 2419 | + | |
| 2420 | + | |
| 2421 | + | |
2401 | 2422 | | |
2402 | 2423 | | |
2403 | 2424 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1992 | 1992 | | |
1993 | 1993 | | |
1994 | 1994 | | |
| 1995 | + | |
| 1996 | + | |
| 1997 | + | |
| 1998 | + | |
| 1999 | + | |
| 2000 | + | |
| 2001 | + | |
| 2002 | + | |
| 2003 | + | |
| 2004 | + | |
| 2005 | + | |
| 2006 | + | |
| 2007 | + | |
| 2008 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
599 | 599 | | |
600 | 600 | | |
601 | 601 | | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
0 commit comments