Repository navigation
Commit 0deeafa
authored
DuckDB: accept FROM-first queries and TABLE t as subqueries and set operands (#2799)
* DuckDB: accept FROM-first queries and TABLE t as subqueries and set operands
- `(FROM t ...)` is a sub-select wherever `(SELECT ...)` is, and a
parenthesized `FROM t` without pipe operators is a FROM-first select.
- FROM-first queries and `TABLE t` are set operation operands, e.g.
`FROM a UNION ALL FROM b` or `TABLE a EXCEPT TABLE b`, with a trailing
ORDER BY/LIMIT applying to the whole operation.
- `WITH ... TABLE t` keeps and prints its WITH clause.
- The FROM-first scan follows the token chain and stops at the end of
the enclosing parentheses.
* Keep columns named table and print every clause of TABLE t
- `(TABLE` starts a sub-select only when a table name follows and then
the end of the query, so `(table = 'hits')` and `(table)` stay
expressions on a column named table. `FROM (TABLE s.t) x` now parses.
- A parenthesized `FROM t` without clauses stays a `FromQuery`.
- `TableStatement` uses `Select.appendTo`, and its deparser prints
OPTION, FETCH and the isolation level, so `TABLE t FETCH FIRST 1 ROWS
ONLY` keeps its FETCH.
- `CREATE TABLE ... AS` takes any query, including `TABLE a UNION TABLE b`.1 parent a90873f commit 0deeafa
4 files changed
Lines changed: 128 additions & 31 deletions
File tree
- src
- main
- java/net/sf/jsqlparser
- statement/select
- util/deparser
- jjtree/net/sf/jsqlparser/parser
- test/java/net/sf/jsqlparser/statement/select
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | 37 | | |
55 | 38 | | |
56 | 39 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
| |||
84 | 86 | | |
85 | 87 | | |
86 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
87 | 101 | | |
88 | 102 | | |
89 | 103 | | |
90 | 104 | | |
91 | 105 | | |
92 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
93 | 110 | | |
94 | 111 | | |
95 | 112 | | |
96 | 113 | | |
97 | 114 | | |
98 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
99 | 122 | | |
100 | 123 | | |
101 | 124 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
745 | 745 | | |
746 | 746 | | |
747 | 747 | | |
748 | | - | |
| 748 | + | |
| 749 | + | |
749 | 750 | | |
750 | 751 | | |
751 | 752 | | |
| |||
777 | 778 | | |
778 | 779 | | |
779 | 780 | | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
780 | 803 | | |
781 | 804 | | |
782 | 805 | | |
783 | 806 | | |
784 | | - | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
785 | 810 | | |
786 | 811 | | |
787 | 812 | | |
| |||
1393 | 1418 | | |
1394 | 1419 | | |
1395 | 1420 | | |
1396 | | - | |
| 1421 | + | |
| 1422 | + | |
1397 | 1423 | | |
1398 | 1424 | | |
1399 | 1425 | | |
1400 | | - | |
1401 | | - | |
1402 | | - | |
1403 | | - | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
1404 | 1429 | | |
1405 | 1430 | | |
1406 | 1431 | | |
1407 | 1432 | | |
1408 | 1433 | | |
1409 | | - | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
1410 | 1438 | | |
1411 | 1439 | | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
1412 | 1444 | | |
1413 | 1445 | | |
1414 | 1446 | | |
| |||
3480 | 3512 | | |
3481 | 3513 | | |
3482 | 3514 | | |
3483 | | - | |
3484 | | - | |
3485 | 3515 | | |
3486 | 3516 | | |
3487 | 3517 | | |
| |||
7175 | 7205 | | |
7176 | 7206 | | |
7177 | 7207 | | |
7178 | | - | |
7179 | | - | |
7180 | | - | |
| 7208 | + | |
7181 | 7209 | | |
7182 | 7210 | | |
7183 | 7211 | | |
| 7212 | + | |
| 7213 | + | |
| 7214 | + | |
| 7215 | + | |
| 7216 | + | |
7184 | 7217 | | |
7185 | 7218 | | |
7186 | 7219 | | |
| |||
8146 | 8179 | | |
8147 | 8180 | | |
8148 | 8181 | | |
| 8182 | + | |
| 8183 | + | |
| 8184 | + | |
| 8185 | + | |
8149 | 8186 | | |
8150 | 8187 | | |
8151 | 8188 | | |
| |||
8196 | 8233 | | |
8197 | 8234 | | |
8198 | 8235 | | |
| 8236 | + | |
| 8237 | + | |
| 8238 | + | |
| 8239 | + | |
| 8240 | + | |
| 8241 | + | |
| 8242 | + | |
| 8243 | + | |
| 8244 | + | |
| 8245 | + | |
| 8246 | + | |
| 8247 | + | |
| 8248 | + | |
| 8249 | + | |
8199 | 8250 | | |
8200 | 8251 | | |
8201 | 8252 | | |
| |||
15826 | 15877 | | |
15827 | 15878 | | |
15828 | 15879 | | |
15829 | | - | |
| 15880 | + | |
15830 | 15881 | | |
15831 | 15882 | | |
15832 | 15883 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
825 | 825 | | |
826 | 826 | | |
827 | 827 | | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
828 | 868 | | |
0 commit comments