blob: 9c4bd277ca0bacafd6bc4f5d4a162836dfe80476 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
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
195
196
197
198
199
200
201
202
203
204
205
206
|
--------------------------------------
-- Unnest Subqueries
--------------------------------------
SELECT *
FROM x AS x
WHERE
x.a IN (SELECT y.a AS a FROM y)
AND x.a IN (SELECT y.b AS b FROM y)
AND x.a = ANY (SELECT y.a AS a FROM y)
AND x.a = (SELECT SUM(y.b) AS b FROM y WHERE x.a = y.a)
AND x.a > (SELECT SUM(y.b) AS b FROM y WHERE x.a = y.a)
AND x.a <> ANY (SELECT y.a AS a FROM y WHERE y.a = x.a)
AND x.a NOT IN (SELECT y.a AS a FROM y WHERE y.a = x.a)
AND x.a IN (SELECT y.a AS a FROM y WHERE y.b = x.a)
AND x.a < (SELECT SUM(y.a) AS a FROM y WHERE y.a = x.a and y.a = x.b and y.b <> x.d)
AND EXISTS (SELECT y.a AS a, y.b AS b FROM y WHERE x.a = y.a)
AND x.a IN (SELECT y.a AS a FROM y LIMIT 10)
AND x.a IN (SELECT y.a AS a FROM y OFFSET 10)
AND x.a IN (SELECT y.a AS a, y.b AS b FROM y)
AND x.a > ANY (SELECT y.a FROM y)
AND x.a = (SELECT SUM(y.c) AS c FROM y WHERE y.a = x.a LIMIT 10)
AND x.a = (SELECT SUM(y.c) AS c FROM y WHERE y.a = x.a OFFSET 10)
;
SELECT
*
FROM x AS x
LEFT JOIN (
SELECT
y.a AS a
FROM y
GROUP BY
y.a
) AS "_u_0"
ON x.a = "_u_0"."a"
LEFT JOIN (
SELECT
y.b AS b
FROM y
GROUP BY
y.b
) AS "_u_1"
ON x.a = "_u_1"."b"
LEFT JOIN (
SELECT
y.a AS a
FROM y
GROUP BY
y.a
) AS "_u_2"
ON x.a = "_u_2"."a"
LEFT JOIN (
SELECT
SUM(y.b) AS b,
y.a AS _u_4
FROM y
WHERE
TRUE
GROUP BY
y.a
) AS "_u_3"
ON x.a = "_u_3"."_u_4"
LEFT JOIN (
SELECT
SUM(y.b) AS b,
y.a AS _u_6
FROM y
WHERE
TRUE
GROUP BY
y.a
) AS "_u_5"
ON x.a = "_u_5"."_u_6"
LEFT JOIN (
SELECT
y.a AS a
FROM y
WHERE
TRUE
GROUP BY
y.a
) AS "_u_7"
ON "_u_7".a = x.a
LEFT JOIN (
SELECT
y.a AS a
FROM y
WHERE
TRUE
GROUP BY
y.a
) AS "_u_8"
ON "_u_8".a = x.a
LEFT JOIN (
SELECT
ARRAY_AGG(y.a) AS a,
y.b AS _u_10
FROM y
WHERE
TRUE
GROUP BY
y.b
) AS "_u_9"
ON "_u_9"."_u_10" = x.a
LEFT JOIN (
SELECT
SUM(y.a) AS a,
y.a AS _u_12,
ARRAY_AGG(y.b) AS _u_13
FROM y
WHERE
TRUE
AND TRUE
AND TRUE
GROUP BY
y.a
) AS "_u_11"
ON "_u_11"."_u_12" = x.a
AND "_u_11"."_u_12" = x.b
LEFT JOIN (
SELECT
y.a AS a
FROM y
WHERE
TRUE
GROUP BY
y.a
) AS "_u_14"
ON x.a = "_u_14".a
WHERE
NOT "_u_0"."a" IS NULL
AND NOT "_u_1"."b" IS NULL
AND NOT "_u_2"."a" IS NULL
AND (
x.a = "_u_3".b
AND NOT "_u_3"."_u_4" IS NULL
)
AND (
x.a > "_u_5".b
AND NOT "_u_5"."_u_6" IS NULL
)
AND (
None = "_u_7".a
AND NOT "_u_7".a IS NULL
)
AND NOT (
x.a = "_u_8".a
AND NOT "_u_8".a IS NULL
)
AND (
ARRAY_ANY("_u_9".a, _x -> _x = x.a)
AND NOT "_u_9"."_u_10" IS NULL
)
AND (
(
(
x.a < "_u_11".a
AND NOT "_u_11"."_u_12" IS NULL
)
AND NOT "_u_11"."_u_12" IS NULL
)
AND ARRAY_ANY("_u_11"."_u_13", "_x" -> "_x" <> x.d)
)
AND (
NOT "_u_14".a IS NULL
AND NOT "_u_14".a IS NULL
)
AND x.a IN (
SELECT
y.a AS a
FROM y
LIMIT 10
)
AND x.a IN (
SELECT
y.a AS a
FROM y
OFFSET 10
)
AND x.a IN (
SELECT
y.a AS a,
y.b AS b
FROM y
)
AND x.a > ANY (
SELECT
y.a
FROM y
)
AND x.a = (
SELECT
SUM(y.c) AS c
FROM y
WHERE
y.a = x.a
LIMIT 10
)
AND x.a = (
SELECT
SUM(y.c) AS c
FROM y
WHERE
y.a = x.a
OFFSET 10
);
|