forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commita1627a1
committed
From: David Hartwig <daybee@bellatlantic.net>I have attached a patch to allow GROUP BY and/or ORDER BY function orexpressions. Note worthy items:1. The expression or function need not be in the target list.Example: SELECT name FROM foo GROUP BY lower(name);2. Simplified the grammar to use expressions only.3. Cleaned up earlier patch in this area to make use of existingutility functions.3. Reduced some of the members in the SortGroupBy parse node. Theoriginal data members were redundant with the new expression node.(MUST do a "make clean" now)4. Added a new parse node "JoinUsing". The JOIN USING clause wasoverloading this SortGroupBy structure. With the afore mentionedreduction of members, the two clauses lost all their commonality.5. A bug still exist where, if a function or expression is GROUPed BY,and an aggregate function does not include a attribute from theexpression or function, the backend crashes. (or something likethat) The bug pre-dates this patch. Example: SELECT lower(a) AS lowcase, count(b) FROM foo GROUP BY lowcase; *** BOOM *** --Also when not in target list SELECT count(b) FROM foo GROUP BY lower(a); *** BOOM AGAIN ***
1 parent186aeb1 commita1627a1
File tree
8 files changed
+435
-195
lines changed- src
- backend/parser
- include
- nodes
- parser
- test/regress
- expected
- sql
8 files changed
+435
-195
lines changedLines changed: 19 additions & 62 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
10 | 10 |
| |
11 | 11 |
| |
12 | 12 |
| |
13 |
| - | |
| 13 | + | |
14 | 14 |
| |
15 | 15 |
| |
16 | 16 |
| |
| |||
103 | 103 |
| |
104 | 104 |
| |
105 | 105 |
| |
| 106 | + | |
106 | 107 |
| |
107 | 108 |
| |
108 | 109 |
| |
| |||
162 | 163 |
| |
163 | 164 |
| |
164 | 165 |
| |
165 |
| - | |
| 166 | + | |
166 | 167 |
| |
167 | 168 |
| |
168 | 169 |
| |
| |||
171 | 172 |
| |
172 | 173 |
| |
173 | 174 |
| |
174 |
| - | |
| 175 | + | |
175 | 176 |
| |
176 | 177 |
| |
177 | 178 |
| |
| |||
211 | 212 |
| |
212 | 213 |
| |
213 | 214 |
| |
214 |
| - | |
215 | 215 |
| |
216 | 216 |
| |
217 | 217 |
| |
| |||
2517 | 2517 |
| |
2518 | 2518 |
| |
2519 | 2519 |
| |
2520 |
| - | |
| 2520 | + | |
2521 | 2521 |
| |
2522 | 2522 |
| |
2523 |
| - | |
2524 |
| - | |
2525 |
| - | |
2526 |
| - | |
2527 |
| - | |
2528 |
| - | |
2529 |
| - | |
2530 |
| - | |
2531 |
| - | |
2532 |
| - | |
2533 |
| - | |
2534 |
| - | |
2535 |
| - | |
2536 |
| - | |
2537 |
| - | |
2538 |
| - | |
2539 |
| - | |
2540 |
| - | |
2541 |
| - | |
| 2523 | + | |
2542 | 2524 |
| |
2543 | 2525 |
| |
2544 | 2526 |
| |
| |||
2570 | 2552 |
| |
2571 | 2553 |
| |
2572 | 2554 |
| |
2573 |
| - | |
| 2555 | + | |
2574 | 2556 |
| |
2575 | 2557 |
| |
2576 | 2558 |
| |
2577 |
| - | |
2578 |
| - | |
2579 |
| - | |
2580 |
| - | |
2581 |
| - | |
2582 |
| - | |
2583 |
| - | |
2584 |
| - | |
2585 |
| - | |
2586 |
| - | |
2587 |
| - | |
2588 |
| - | |
2589 |
| - | |
2590 |
| - | |
2591 |
| - | |
2592 |
| - | |
2593 |
| - | |
2594 |
| - | |
2595 |
| - | |
2596 |
| - | |
2597 |
| - | |
2598 |
| - | |
2599 |
| - | |
2600 |
| - | |
2601 |
| - | |
2602 |
| - | |
2603 |
| - | |
2604 |
| - | |
2605 |
| - | |
2606 |
| - | |
2607 | 2559 |
| |
2608 | 2560 |
| |
2609 | 2561 |
| |
| |||
2688 | 2640 |
| |
2689 | 2641 |
| |
2690 | 2642 |
| |
2691 |
| - | |
2692 |
| - | |
| 2643 | + | |
| 2644 | + | |
| 2645 | + | |
| 2646 | + | |
| 2647 | + | |
| 2648 | + | |
| 2649 | + | |
| 2650 | + | |
| 2651 | + | |
| 2652 | + | |
2693 | 2653 |
| |
2694 | 2654 |
| |
2695 | 2655 |
| |
2696 |
| - | |
2697 | 2656 |
| |
2698 | 2657 |
| |
2699 | 2658 |
| |
2700 |
| - | |
| 2659 | + | |
2701 | 2660 |
| |
2702 | 2661 |
| |
2703 | 2662 |
| |
2704 |
| - | |
2705 | 2663 |
| |
2706 | 2664 |
| |
2707 | 2665 |
| |
2708 |
| - | |
| 2666 | + | |
2709 | 2667 |
| |
2710 | 2668 |
| |
2711 | 2669 |
| |
2712 |
| - | |
2713 | 2670 |
| |
2714 | 2671 |
| |
2715 | 2672 |
| |
|
0 commit comments
Comments
(0)