- Notifications
You must be signed in to change notification settings - Fork5k
Commit9e98583
committed
Create routine able to set single-call SRFs for Materialize mode
Set-returning functions that use the Materialize mode, creating atuplestore to include all the tuples returned in a set rather than doingso in multiple calls, use roughly the same set of steps to prepareReturnSetInfo for this job:- Check if ReturnSetInfo supports returning a tuplestore and if thematerialize mode is enabled.- Create a tuplestore for all the tuples part of the returned set in theper-query memory context, stored in ReturnSetInfo->setResult.- Build a tuple descriptor mostly from get_call_result_type(), thenstored in ReturnSetInfo->setDesc. Note that there are some cases wherethe SRF's tuple descriptor has to be the one specified by the functioncaller.This refactoring is done so as there are (well, should be) no behaviorchanges in any of the in-core functions refactored, and the centralizedfunction that checks and sets up the function's ReturnSetInfo can becontrolled with a set of bits32 options. Two of them prove to benecessary now:- SRF_SINGLE_USE_EXPECTED to use expectedDesc as tuple descriptor, asexpected by the function's caller.- SRF_SINGLE_BLESS to validate the tuple descriptor for the SRF.The same initialization pattern is simplified in 28 places per mycount as of src/backend/, shaving up to ~900 lines of code. Thesemostly come from the removal of the per-query initializations and thesanity checks now grouped in a single location. There are morelocations that could be simplified in contrib/, that are left for afollow-up cleanup.fcc2817,07daca5 and d61a361 have prepared the areas of the code relatedto this change, to ease this refactoring.Author: Melanie Plageman, Michael PaquierReviewed-by: Álvaro Herrera, Justin PryzbyDiscussion:https://postgr.es/m/CAAKRu_azyd1Z3W_r7Ou4sorTjRCs+PxeHw1CWJeXKofkE6TuZg@mail.gmail.com1 parent770011e commit9e98583
File tree
24 files changed
+176
-872
lines changed- src
- backend
- commands
- foreign
- libpq
- replication
- logical
- storage/ipc
- utils
- adt
- fmgr
- misc
- mmgr
- include
24 files changed
+176
-872
lines changedLines changed: 6 additions & 56 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1290 | 1290 |
| |
1291 | 1291 |
| |
1292 | 1292 |
| |
1293 |
| - | |
1294 |
| - | |
1295 |
| - | |
1296 |
| - | |
1297 | 1293 |
| |
1298 | 1294 |
| |
1299 | 1295 |
| |
| |||
1306 | 1302 |
| |
1307 | 1303 |
| |
1308 | 1304 |
| |
1309 |
| - | |
1310 |
| - | |
1311 |
| - | |
1312 |
| - | |
1313 |
| - | |
1314 |
| - | |
1315 |
| - | |
1316 |
| - | |
1317 |
| - | |
1318 |
| - | |
1319 |
| - | |
1320 |
| - | |
1321 |
| - | |
1322 |
| - | |
1323 | 1305 |
| |
1324 |
| - | |
1325 |
| - | |
1326 |
| - | |
1327 |
| - | |
1328 |
| - | |
1329 |
| - | |
1330 |
| - | |
1331 |
| - | |
1332 |
| - | |
| 1306 | + | |
1333 | 1307 |
| |
1334 | 1308 |
| |
1335 | 1309 |
| |
| |||
1398 | 1372 |
| |
1399 | 1373 |
| |
1400 | 1374 |
| |
1401 |
| - | |
| 1375 | + | |
| 1376 | + | |
1402 | 1377 |
| |
1403 | 1378 |
| |
1404 | 1379 |
| |
| |||
1846 | 1821 |
| |
1847 | 1822 |
| |
1848 | 1823 |
| |
1849 |
| - | |
1850 |
| - | |
1851 |
| - | |
1852 |
| - | |
1853 | 1824 |
| |
1854 | 1825 |
| |
1855 | 1826 |
| |
| |||
1861 | 1832 |
| |
1862 | 1833 |
| |
1863 | 1834 |
| |
1864 |
| - | |
1865 |
| - | |
1866 |
| - | |
1867 |
| - | |
1868 |
| - | |
1869 |
| - | |
1870 |
| - | |
1871 |
| - | |
1872 |
| - | |
1873 |
| - | |
1874 |
| - | |
1875 |
| - | |
1876 |
| - | |
1877 |
| - | |
1878 | 1835 |
| |
1879 |
| - | |
1880 |
| - | |
1881 |
| - | |
1882 |
| - | |
1883 |
| - | |
1884 |
| - | |
1885 |
| - | |
1886 |
| - | |
1887 |
| - | |
| 1836 | + | |
1888 | 1837 |
| |
1889 | 1838 |
| |
1890 | 1839 |
| |
| |||
2055 | 2004 |
| |
2056 | 2005 |
| |
2057 | 2006 |
| |
2058 |
| - | |
| 2007 | + | |
| 2008 | + | |
2059 | 2009 |
| |
2060 | 2010 |
| |
2061 | 2011 |
| |
|
Lines changed: 9 additions & 84 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1932 | 1932 |
| |
1933 | 1933 |
| |
1934 | 1934 |
| |
1935 |
| - | |
1936 |
| - | |
1937 |
| - | |
1938 |
| - | |
1939 | 1935 |
| |
1940 | 1936 |
| |
1941 | 1937 |
| |
1942 | 1938 |
| |
1943 |
| - | |
1944 |
| - | |
1945 |
| - | |
1946 |
| - | |
1947 |
| - | |
1948 |
| - | |
1949 |
| - | |
1950 |
| - | |
1951 |
| - | |
1952 |
| - | |
1953 |
| - | |
1954 |
| - | |
1955 |
| - | |
1956 |
| - | |
1957 | 1939 |
| |
1958 |
| - | |
1959 |
| - | |
1960 |
| - | |
1961 |
| - | |
1962 |
| - | |
1963 |
| - | |
1964 |
| - | |
1965 |
| - | |
1966 |
| - | |
| 1940 | + | |
1967 | 1941 |
| |
1968 | 1942 |
| |
1969 | 1943 |
| |
| |||
2015 | 1989 |
| |
2016 | 1990 |
| |
2017 | 1991 |
| |
2018 |
| - | |
| 1992 | + | |
| 1993 | + | |
2019 | 1994 |
| |
2020 | 1995 |
| |
2021 | 1996 |
| |
| |||
2037 | 2012 |
| |
2038 | 2013 |
| |
2039 | 2014 |
| |
2040 |
| - | |
2041 |
| - | |
2042 |
| - | |
2043 |
| - | |
2044 | 2015 |
| |
2045 | 2016 |
| |
2046 | 2017 |
| |
2047 | 2018 |
| |
2048 |
| - | |
2049 |
| - | |
2050 |
| - | |
2051 |
| - | |
2052 |
| - | |
2053 |
| - | |
2054 |
| - | |
2055 |
| - | |
2056 |
| - | |
2057 |
| - | |
2058 |
| - | |
2059 |
| - | |
2060 |
| - | |
2061 |
| - | |
2062 | 2019 |
| |
2063 |
| - | |
2064 |
| - | |
2065 |
| - | |
2066 |
| - | |
2067 |
| - | |
2068 |
| - | |
2069 |
| - | |
2070 |
| - | |
2071 |
| - | |
| 2020 | + | |
2072 | 2021 |
| |
2073 | 2022 |
| |
2074 | 2023 |
| |
| |||
2103 | 2052 |
| |
2104 | 2053 |
| |
2105 | 2054 |
| |
2106 |
| - | |
| 2055 | + | |
| 2056 | + | |
2107 | 2057 |
| |
2108 | 2058 |
| |
2109 | 2059 |
| |
| |||
2316 | 2266 |
| |
2317 | 2267 |
| |
2318 | 2268 |
| |
2319 |
| - | |
2320 |
| - | |
2321 |
| - | |
2322 |
| - | |
2323 | 2269 |
| |
2324 | 2270 |
| |
2325 | 2271 |
| |
2326 | 2272 |
| |
2327 | 2273 |
| |
2328 | 2274 |
| |
2329 | 2275 |
| |
2330 |
| - | |
2331 |
| - | |
2332 |
| - | |
2333 |
| - | |
2334 |
| - | |
2335 |
| - | |
2336 |
| - | |
2337 |
| - | |
2338 |
| - | |
2339 |
| - | |
2340 |
| - | |
2341 |
| - | |
2342 |
| - | |
2343 |
| - | |
2344 | 2276 |
| |
2345 |
| - | |
2346 |
| - | |
2347 |
| - | |
2348 |
| - | |
2349 |
| - | |
2350 |
| - | |
2351 |
| - | |
2352 |
| - | |
2353 |
| - | |
| 2277 | + | |
2354 | 2278 |
| |
2355 | 2279 |
| |
2356 | 2280 |
| |
| |||
2407 | 2331 |
| |
2408 | 2332 |
| |
2409 | 2333 |
| |
2410 |
| - | |
| 2334 | + | |
| 2335 | + | |
2411 | 2336 |
| |
2412 | 2337 |
| |
2413 | 2338 |
| |
|
Lines changed: 3 additions & 31 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
702 | 702 |
| |
703 | 703 |
| |
704 | 704 |
| |
705 |
| - | |
706 |
| - | |
707 |
| - | |
708 |
| - | |
709 |
| - | |
710 |
| - | |
711 |
| - | |
712 |
| - | |
713 |
| - | |
714 |
| - | |
715 |
| - | |
716 |
| - | |
717 |
| - | |
718 |
| - | |
719 |
| - | |
720 |
| - | |
721 |
| - | |
722 |
| - | |
723 |
| - | |
724 |
| - | |
725 |
| - | |
726 | 705 |
| |
727 | 706 |
| |
728 | 707 |
| |
729 | 708 |
| |
730 | 709 |
| |
731 |
| - | |
732 |
| - | |
733 |
| - | |
734 |
| - | |
735 |
| - | |
736 |
| - | |
737 |
| - | |
738 |
| - | |
739 |
| - | |
| 710 | + | |
740 | 711 |
| |
741 | 712 |
| |
742 | 713 |
| |
| |||
761 | 732 |
| |
762 | 733 |
| |
763 | 734 |
| |
764 |
| - | |
| 735 | + | |
| 736 | + | |
765 | 737 |
| |
766 | 738 |
| |
767 | 739 |
| |
|
Lines changed: 5 additions & 29 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
20 | 20 |
| |
21 | 21 |
| |
22 | 22 |
| |
| 23 | + | |
23 | 24 |
| |
24 | 25 |
| |
25 | 26 |
| |
| |||
510 | 511 |
| |
511 | 512 |
| |
512 | 513 |
| |
513 |
| - | |
514 |
| - | |
515 |
| - | |
516 |
| - | |
517 |
| - | |
518 |
| - | |
519 |
| - | |
520 |
| - | |
521 |
| - | |
522 |
| - | |
523 |
| - | |
524 |
| - | |
525 |
| - | |
526 |
| - | |
527 |
| - | |
528 | 514 |
| |
529 | 515 |
| |
530 | 516 |
| |
531 | 517 |
| |
532 |
| - | |
533 |
| - | |
534 |
| - | |
535 |
| - | |
536 |
| - | |
537 |
| - | |
538 |
| - | |
539 |
| - | |
540 |
| - | |
541 |
| - | |
542 |
| - | |
543 |
| - | |
544 |
| - | |
| 518 | + | |
| 519 | + | |
545 | 520 |
| |
546 | 521 |
| |
547 | 522 |
| |
| |||
561 | 536 |
| |
562 | 537 |
| |
563 | 538 |
| |
564 |
| - | |
| 539 | + | |
| 540 | + | |
565 | 541 |
| |
566 | 542 |
| |
567 | 543 |
| |
|
0 commit comments
Comments
(0)