- Notifications
You must be signed in to change notification settings - Fork5
Commit784e762
committed
Support multi-argument UNNEST(), and TABLE() syntax for multiple functions.
This patch adds the ability to write TABLE( function1(), function2(), ...)as a single FROM-clause entry. The result is the concatenation of thefirst row from each function, followed by the second row from eachfunction, etc; with NULLs inserted if any function produces fewer rows thanothers. This is believed to be a much more useful behavior than whatPostgres currently does with multiple SRFs in a SELECT list.This syntax also provides a reasonable way to combine use of columndefinition lists with WITH ORDINALITY: put the column definition listinside TABLE(), where it's clear that it doesn't control the ordinalitycolumn as well.Also implement SQL-compliant multiple-argument UNNEST(), by turningUNNEST(a,b,c) into TABLE(unnest(a), unnest(b), unnest(c)).The SQL standard specifies TABLE() with only a single function, notmultiple functions, and it seems to require an implicit UNNEST() which isnot what this patch does. There may be something wrong with that readingof the spec, though, because if it's right then the spec's TABLE() is justa pointless alternative spelling of UNNEST(). After further review ofthat, we might choose to adopt a different syntax for what this patch does,but in any case this functionality seems clearly worthwhile.Andrew Gierth, reviewed by Zoltán Böszörményi and Heikki Linnakangas, andsignificantly revised by me1 parent38f4328 commit784e762
File tree
48 files changed
+2639
-1203
lines changed- contrib/pg_stat_statements
- doc/src/sgml
- ref
- src
- backend
- access/common
- catalog
- commands
- executor
- nodes
- optimizer
- path
- plan
- prep
- util
- parser
- rewrite
- utils/adt
- include
- access
- catalog
- nodes
- optimizer
- parser
- test/regress
- expected
- sql
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
48 files changed
+2639
-1203
lines changedLines changed: 8 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1456 | 1456 |
| |
1457 | 1457 |
| |
1458 | 1458 |
| |
1459 |
| - | |
| 1459 | + | |
1460 | 1460 |
| |
1461 | 1461 |
| |
1462 | 1462 |
| |
| |||
1866 | 1866 |
| |
1867 | 1867 |
| |
1868 | 1868 |
| |
| 1869 | + | |
| 1870 | + | |
| 1871 | + | |
| 1872 | + | |
| 1873 | + | |
| 1874 | + | |
| 1875 | + | |
1869 | 1876 |
| |
1870 | 1877 |
| |
1871 | 1878 |
| |
|
Lines changed: 22 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
11185 | 11185 |
| |
11186 | 11186 |
| |
11187 | 11187 |
| |
| 11188 | + | |
| 11189 | + | |
| 11190 | + | |
| 11191 | + | |
| 11192 | + | |
| 11193 | + | |
| 11194 | + | |
| 11195 | + | |
| 11196 | + | |
| 11197 | + | |
| 11198 | + | |
| 11199 | + | |
| 11200 | + | |
| 11201 | + | |
| 11202 | + | |
11188 | 11203 |
| |
11189 | 11204 |
| |
11190 | 11205 |
| |
| |||
13295 | 13310 |
| |
13296 | 13311 |
| |
13297 | 13312 |
| |
| 13313 | + | |
| 13314 | + | |
13298 | 13315 |
| |
13299 | 13316 |
| |
13300 | 13317 |
| |
| |||
13499 | 13516 |
| |
13500 | 13517 |
| |
13501 | 13518 |
| |
13502 |
| - | |
13503 |
| - | |
13504 |
| - | |
13505 |
| - | |
13506 |
| - | |
13507 |
| - | |
13508 |
| - | |
13509 |
| - | |
| 13519 | + | |
| 13520 | + | |
| 13521 | + | |
| 13522 | + | |
| 13523 | + | |
13510 | 13524 |
| |
13511 | 13525 |
| |
13512 | 13526 |
| |
|
Lines changed: 67 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
643 | 643 |
| |
644 | 644 |
| |
645 | 645 |
| |
646 |
| - | |
| 646 | + | |
647 | 647 |
| |
648 | 648 |
| |
649 | 649 |
| |
650 |
| - | |
651 |
| - | |
652 |
| - | |
653 |
| - | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
654 | 654 |
| |
655 | 655 |
| |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 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 | + | |
656 | 684 |
| |
657 |
| - | |
658 |
| - | |
659 |
| - | |
660 |
| - | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
661 | 695 |
| |
662 | 696 |
| |
663 | 697 |
| |
| |||
691 | 725 |
| |
692 | 726 |
| |
693 | 727 |
| |
694 |
| - | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
695 | 752 |
| |
696 | 753 |
| |
697 | 754 |
| |
|
Lines changed: 62 additions & 21 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
52 | 52 |
| |
53 | 53 |
| |
54 | 54 |
| |
55 |
| - | |
| 55 | + | |
| 56 | + | |
56 | 57 |
| |
57 | 58 |
| |
| 59 | + | |
| 60 | + | |
58 | 61 |
| |
59 | 62 |
| |
60 | 63 |
| |
| |||
368 | 371 |
| |
369 | 372 |
| |
370 | 373 |
| |
371 |
| - | |
| 374 | + | |
372 | 375 |
| |
373 |
| - | |
374 |
| - | |
375 |
| - | |
376 |
| - | |
377 |
| - | |
378 |
| - | |
379 |
| - | |
380 |
| - | |
381 |
| - | |
382 |
| - | |
383 |
| - | |
384 |
| - | |
385 |
| - | |
386 |
| - | |
387 |
| - | |
388 |
| - | |
389 |
| - | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
390 | 384 |
| |
391 | 385 |
| |
392 | 386 |
| |
393 | 387 |
| |
394 |
| - | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
395 | 400 |
| |
396 | 401 |
| |
397 | 402 |
| |
| |||
402 | 407 |
| |
403 | 408 |
| |
404 | 409 |
| |
405 |
| - | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
406 | 425 |
| |
407 | 426 |
| |
408 | 427 |
| |
| |||
1598 | 1617 |
| |
1599 | 1618 |
| |
1600 | 1619 |
| |
| 1620 | + | |
| 1621 | + | |
| 1622 | + | |
| 1623 | + | |
| 1624 | + | |
| 1625 | + | |
| 1626 | + | |
| 1627 | + | |
| 1628 | + | |
| 1629 | + | |
| 1630 | + | |
| 1631 | + | |
| 1632 | + | |
| 1633 | + | |
| 1634 | + | |
| 1635 | + | |
| 1636 | + | |
1601 | 1637 |
| |
1602 | 1638 |
| |
1603 | 1639 |
| |
| |||
1773 | 1809 |
| |
1774 | 1810 |
| |
1775 | 1811 |
| |
| 1812 | + | |
| 1813 | + | |
| 1814 | + | |
| 1815 | + | |
| 1816 | + | |
1776 | 1817 |
| |
1777 | 1818 |
| |
1778 | 1819 |
| |
|
Lines changed: 41 additions & 34 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
157 | 157 |
| |
158 | 158 |
| |
159 | 159 |
| |
160 |
| - | |
161 |
| - | |
162 |
| - | |
163 |
| - | |
164 |
| - | |
165 |
| - | |
166 |
| - | |
167 |
| - | |
168 |
| - | |
169 |
| - | |
170 |
| - | |
171 |
| - | |
172 |
| - | |
173 |
| - | |
174 |
| - | |
175 |
| - | |
176 |
| - | |
177 |
| - | |
178 |
| - | |
179 |
| - | |
180 |
| - | |
181 |
| - | |
182 |
| - | |
183 |
| - | |
184 |
| - | |
185 |
| - | |
186 |
| - | |
187 |
| - | |
188 |
| - | |
189 |
| - | |
190 |
| - | |
191 |
| - | |
192 |
| - | |
193 |
| - | |
194 | 160 |
| |
195 | 161 |
| |
196 | 162 |
| |
| |||
250 | 216 |
| |
251 | 217 |
| |
252 | 218 |
| |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
253 | 260 |
| |
254 | 261 |
| |
255 | 262 |
| |
|
0 commit comments
Comments
(0)