forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit0d3f440
committed
Allow aggregate functions to be VARIADIC.
There's no inherent reason why an aggregate function can't be variadic(even VARIADIC ANY) if its transition function can handle the case.Indeed, this patch to add the feature touches none of the planner orexecutor, and little of the parser; the main missing stuff was DDL andpg_dump support.It is true that variadic aggregates can create the same sort of ambiguityabout parameters versus ORDER BY keys that was complained of when we(briefly) had both one- and two-argument forms of string_agg(). However,the policy formed in response to that discussion only said that we'd notcreate any built-in aggregates with varying numbers of arguments, not thatwe shouldn't allow users to do it. So the logical extension of that iswe can allow users to make variadic aggregates as long as we're wary aboutshipping any such in core.In passing, this patch allows aggregate function arguments to be named, tothe extent of remembering the names in pg_proc and dumping them in pg_dump.You can't yet call an aggregate using named-parameter notation. That seemslike a likely future extension, but it'll take some work, and it's not whatthis patch is really about. Likewise, there's still some work needed tomake window functions handle VARIADIC fully, but I left that for anotherday.initdb forced because of new aggvariadic field in Aggref parse nodes.1 parent8b290f3 commit0d3f440
File tree
35 files changed
+448
-116
lines changed- doc/src/sgml
- ref
- src
- backend
- catalog
- commands
- executor
- nodes
- parser
- tcop
- utils/adt
- bin
- pg_dump
- psql
- include
- catalog
- commands
- nodes
- parser
- test/regress
- expected
- sql
35 files changed
+448
-116
lines changedLines changed: 32 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
21 | 21 |
| |
22 | 22 |
| |
23 | 23 |
| |
24 |
| - | |
25 |
| - | |
26 |
| - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
27 | 30 |
| |
28 | 31 |
| |
29 | 32 |
| |
| |||
62 | 65 |
| |
63 | 66 |
| |
64 | 67 |
| |
65 |
| - | |
| 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 | + | |
66 | 93 |
| |
67 | 94 |
| |
68 | 95 |
| |
69 | 96 |
| |
70 |
| - | |
| 97 | + | |
71 | 98 |
| |
72 | 99 |
| |
73 | 100 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
30 | 30 |
| |
31 | 31 |
| |
32 | 32 |
| |
33 |
| - | |
| 33 | + | |
34 | 34 |
| |
35 | 35 |
| |
36 | 36 |
| |
| |||
179 | 179 |
| |
180 | 180 |
| |
181 | 181 |
| |
182 |
| - | |
| 182 | + | |
183 | 183 |
| |
184 | 184 |
| |
185 | 185 |
| |
|
Lines changed: 4 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
23 | 23 |
| |
24 | 24 |
| |
25 | 25 |
| |
26 |
| - | |
| 26 | + | |
27 | 27 |
| |
28 | 28 |
| |
29 | 29 |
| |
| |||
126 | 126 |
| |
127 | 127 |
| |
128 | 128 |
| |
129 |
| - | |
| 129 | + | |
130 | 130 |
| |
131 | 131 |
| |
132 | 132 |
| |
| |||
156 | 156 |
| |
157 | 157 |
| |
158 | 158 |
| |
159 |
| - | |
| 159 | + | |
160 | 160 |
| |
161 | 161 |
| |
162 | 162 |
| |
| |||
170 | 170 |
| |
171 | 171 |
| |
172 | 172 |
| |
173 |
| - | |
| 173 | + | |
174 | 174 |
| |
175 | 175 |
| |
176 | 176 |
| |
|
Lines changed: 30 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
21 | 21 |
| |
22 | 22 |
| |
23 | 23 |
| |
24 |
| - | |
| 24 | + | |
25 | 25 |
| |
26 | 26 |
| |
27 | 27 |
| |
| |||
118 | 118 |
| |
119 | 119 |
| |
120 | 120 |
| |
121 |
| - | |
| 121 | + | |
122 | 122 |
| |
123 | 123 |
| |
124 | 124 |
| |
| |||
187 | 187 |
| |
188 | 188 |
| |
189 | 189 |
| |
190 |
| - | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
191 | 215 |
| |
192 | 216 |
| |
193 | 217 |
| |
194 | 218 |
| |
195 |
| - | |
| 219 | + | |
196 | 220 |
| |
197 | 221 |
| |
198 | 222 |
| |
| |||
205 | 229 |
| |
206 | 230 |
| |
207 | 231 |
| |
208 |
| - | |
209 |
| - | |
| 232 | + | |
| 233 | + | |
210 | 234 |
| |
211 | 235 |
| |
212 | 236 |
| |
|
Lines changed: 29 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
21 | 21 |
| |
22 | 22 |
| |
23 | 23 |
| |
24 |
| - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
25 | 27 |
| |
26 | 28 |
| |
27 | 29 |
| |
| |||
60 | 62 |
| |
61 | 63 |
| |
62 | 64 |
| |
63 |
| - | |
| 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 | + | |
64 | 90 |
| |
65 | 91 |
| |
66 | 92 |
| |
67 | 93 |
| |
68 |
| - | |
| 94 | + | |
69 | 95 |
| |
70 | 96 |
| |
71 | 97 |
| |
|
Lines changed: 5 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
25 | 25 |
| |
26 | 26 |
| |
27 | 27 |
| |
28 |
| - | |
| 28 | + | |
29 | 29 |
| |
30 | 30 |
| |
31 | 31 |
| |
| |||
107 | 107 |
| |
108 | 108 |
| |
109 | 109 |
| |
110 |
| - | |
| 110 | + | |
111 | 111 |
| |
112 | 112 |
| |
113 | 113 |
| |
114 | 114 |
| |
115 |
| - | |
| 115 | + | |
116 | 116 |
| |
117 | 117 |
| |
118 | 118 |
| |
| |||
125 | 125 |
| |
126 | 126 |
| |
127 | 127 |
| |
128 |
| - | |
| 128 | + | |
129 | 129 |
| |
130 | 130 |
| |
131 | 131 |
| |
| |||
140 | 140 |
| |
141 | 141 |
| |
142 | 142 |
| |
143 |
| - | |
| 143 | + | |
144 | 144 |
| |
145 | 145 |
| |
146 | 146 |
| |
|
Lines changed: 7 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2524 | 2524 |
| |
2525 | 2525 |
| |
2526 | 2526 |
| |
| 2527 | + | |
| 2528 | + | |
| 2529 | + | |
| 2530 | + | |
| 2531 | + | |
| 2532 | + | |
| 2533 | + | |
2527 | 2534 |
| |
2528 | 2535 |
| |
2529 | 2536 |
| |
|
Lines changed: 36 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
169 | 169 |
| |
170 | 170 |
| |
171 | 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 | + | |
| 207 | + | |
172 | 208 |
| |
173 | 209 |
| |
174 | 210 |
| |
|
Lines changed: 11 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
45 | 45 |
| |
46 | 46 |
| |
47 | 47 |
| |
48 |
| - | |
49 | 48 |
| |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
50 | 54 |
| |
51 | 55 |
| |
52 | 56 |
| |
| |||
61 | 65 |
| |
62 | 66 |
| |
63 | 67 |
| |
| 68 | + | |
64 | 69 |
| |
65 | 70 |
| |
66 | 71 |
| |
| |||
244 | 249 |
| |
245 | 250 |
| |
246 | 251 |
| |
247 |
| - | |
248 |
| - | |
249 |
| - | |
250 |
| - | |
251 |
| - | |
252 |
| - | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
253 | 257 |
| |
254 | 258 |
| |
255 | 259 |
| |
|
0 commit comments
Comments
(0)