forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitf0fedfe
committed
Allow polymorphic aggregates to have non-polymorphic state data types.
Before 9.4, such an aggregate couldn't be declared, because its finalfunction would have to have polymorphic result type but no polymorphicargument, which CREATE FUNCTION would quite properly reject. Theordered-set-aggregate patch found a workaround: allow the final functionto be declared as accepting additional dummy arguments that have typesmatching the aggregate's regular input arguments. However, we failedto notice that this problem applies just as much to regular aggregates,despite the fact that we had a built-in regular aggregate array_agg()that was known to be undeclarable in SQL because its final functionhad an illegal signature. So what we should have done, and what thispatch does, is to decouple the extra-dummy-arguments behavior fromordered-set aggregates and make it generally available for all aggregatedeclarations. We have to put this into 9.4 rather than waiting tilllater because it slightly alters the rules for declaring ordered-setaggregates.The patch turned out a bit bigger than I'd hoped because it provednecessary to record the extra-arguments option in a new pg_aggregatecolumn. I'd thought we could just look at the final function's pronargsat runtime, but that didn't work well for variadic final functions.It's probably just as well though, because it simplifies life for pg_dumpto record the option explicitly.While at it, fix array_agg() to have a valid final-function signature,and add an opr_sanity test to notice future deviations from polymorphicconsistency. I also marked the percentile_cont() aggregates as notneeding extra arguments, since they don't.1 parent125ba29 commitf0fedfe
File tree
17 files changed
+509
-298
lines changed- doc/src/sgml
- ref
- src
- backend
- catalog
- commands
- executor
- parser
- bin/pg_dump
- include
- catalog
- parser
- test/regress
- expected
- sql
17 files changed
+509
-298
lines changedLines changed: 12 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
404 | 404 |
| |
405 | 405 |
| |
406 | 406 |
| |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
407 | 419 |
| |
408 | 420 |
| |
409 | 421 |
| |
|
Lines changed: 40 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
26 | 26 |
| |
27 | 27 |
| |
28 | 28 |
| |
| 29 | + | |
29 | 30 |
| |
30 | 31 |
| |
31 | 32 |
| |
32 | 33 |
| |
33 | 34 |
| |
34 | 35 |
| |
| 36 | + | |
35 | 37 |
| |
36 | 38 |
| |
37 | 39 |
| |
| |||
42 | 44 |
| |
43 | 45 |
| |
44 | 46 |
| |
| 47 | + | |
45 | 48 |
| |
46 | 49 |
| |
47 | 50 |
| |
| |||
54 | 57 |
| |
55 | 58 |
| |
56 | 59 |
| |
| 60 | + | |
57 | 61 |
| |
58 | 62 |
| |
59 | 63 |
| |
60 | 64 |
| |
61 | 65 |
| |
62 | 66 |
| |
| 67 | + | |
63 | 68 |
| |
64 | 69 |
| |
65 | 70 |
| |
| |||
166 | 171 |
| |
167 | 172 |
| |
168 | 173 |
| |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
169 | 187 |
| |
170 | 188 |
| |
171 | 189 |
| |
172 | 190 |
| |
173 | 191 |
| |
174 |
| - | |
| 192 | + | |
175 | 193 |
| |
176 | 194 |
| |
177 | 195 |
| |
| |||
361 | 379 |
| |
362 | 380 |
| |
363 | 381 |
| |
364 |
| - | |
365 |
| - | |
366 |
| - | |
367 |
| - | |
368 |
| - | |
369 |
| - | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
370 | 392 |
| |
371 | 393 |
| |
372 | 394 |
| |
| |||
438 | 460 |
| |
439 | 461 |
| |
440 | 462 |
| |
441 |
| - | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
442 | 466 |
| |
443 |
| - | |
| 467 | + | |
444 | 468 |
| |
445 | 469 |
| |
446 | 470 |
| |
| |||
494 | 518 |
| |
495 | 519 |
| |
496 | 520 |
| |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
497 | 528 |
| |
498 | 529 |
| |
499 | 530 |
| |
|
Lines changed: 59 additions & 23 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
127 | 127 |
| |
128 | 128 |
| |
129 | 129 |
| |
130 |
| - | |
| 130 | + | |
131 | 131 |
| |
132 | 132 |
| |
133 | 133 |
| |
| |||
182 | 182 |
| |
183 | 183 |
| |
184 | 184 |
| |
185 |
| - | |
| 185 | + | |
186 | 186 |
| |
187 | 187 |
| |
188 | 188 |
| |
| |||
339 | 339 |
| |
340 | 340 |
| |
341 | 341 |
| |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
342 | 383 |
| |
343 | 384 |
| |
344 | 385 |
| |
| |||
401 | 442 |
| |
402 | 443 |
| |
403 | 444 |
| |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
404 | 450 |
| |
405 | 451 |
| |
406 | 452 |
| |
407 | 453 |
| |
408 |
| - | |
| 454 | + | |
| 455 | + | |
409 | 456 |
| |
410 | 457 |
| |
411 | 458 |
| |
412 |
| - | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
413 | 462 |
| |
414 | 463 |
| |
415 | 464 |
| |
| |||
447 | 496 |
| |
448 | 497 |
| |
449 | 498 |
| |
450 |
| - | |
451 |
| - | |
452 |
| - | |
453 |
| - | |
454 |
| - | |
455 |
| - | |
456 |
| - | |
457 |
| - | |
458 |
| - | |
459 |
| - | |
460 |
| - | |
461 |
| - | |
462 |
| - | |
463 |
| - | |
464 |
| - | |
465 |
| - | |
466 |
| - | |
467 |
| - | |
468 |
| - | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
469 | 505 |
| |
470 | 506 |
| |
471 | 507 |
| |
|
Lines changed: 54 additions & 39 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
60 | 60 |
| |
61 | 61 |
| |
62 | 62 |
| |
| 63 | + | |
| 64 | + | |
63 | 65 |
| |
64 | 66 |
| |
65 | 67 |
| |
| |||
344 | 346 |
| |
345 | 347 |
| |
346 | 348 |
| |
347 |
| - | |
348 |
| - | |
349 |
| - | |
350 |
| - | |
351 |
| - | |
352 |
| - | |
353 |
| - | |
354 |
| - | |
355 |
| - | |
356 |
| - | |
357 |
| - | |
358 |
| - | |
359 |
| - | |
360 |
| - | |
361 |
| - | |
362 |
| - | |
363 |
| - | |
364 |
| - | |
365 |
| - | |
366 |
| - | |
367 |
| - | |
368 |
| - | |
369 | 349 |
| |
370 | 350 |
| |
371 | 351 |
| |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
372 | 375 |
| |
373 |
| - | |
| 376 | + | |
374 | 377 |
| |
375 | 378 |
| |
376 | 379 |
| |
377 |
| - | |
378 |
| - | |
379 |
| - | |
380 |
| - | |
381 |
| - | |
382 |
| - | |
383 |
| - | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
384 | 384 |
| |
385 |
| - | |
| 385 | + | |
386 | 386 |
| |
387 | 387 |
| |
388 |
| - | |
| 388 | + | |
389 | 389 |
| |
390 | 390 |
| |
391 | 391 |
| |
| |||
434 | 434 |
| |
435 | 435 |
| |
436 | 436 |
| |
437 |
| - | |
438 |
| - | |
439 |
| - | |
| 437 | + | |
| 438 | + | |
440 | 439 |
| |
| 440 | + | |
| 441 | + | |
441 | 442 |
| |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
442 | 455 |
| |
443 | 456 |
| |
444 |
| - | |
| 457 | + | |
445 | 458 |
| |
446 | 459 |
| |
447 |
| - | |
448 |
| - | |
| 460 | + | |
| 461 | + | |
449 | 462 |
| |
450 | 463 |
| |
451 |
| - | |
| 464 | + | |
452 | 465 |
| |
453 | 466 |
| |
454 | 467 |
| |
| |||
554 | 567 |
| |
555 | 568 |
| |
556 | 569 |
| |
| 570 | + | |
| 571 | + | |
557 | 572 |
| |
558 | 573 |
| |
559 | 574 |
| |
|
0 commit comments
Comments
(0)