mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Repair crash with unsortable data in grouping sets.
Previously the code would generate incorrect results, assertion failures, or crashes if given unsortable (but hashable) columns in grouping sets. Handle by throwing an error instead. Report and patch by Pavan Deolasee (though I changed the error wording slightly); regression test by me. (This affects 9.5 only since the planner was refactored in 9.6.)
This commit is contained in:
@@ -1756,6 +1756,11 @@ grouping_planner(PlannerInfo *root, double tuple_fraction)
|
||||
|
||||
if (parse->groupingSets)
|
||||
{
|
||||
if (!grouping_is_sortable(parse->groupClause))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("could not implement GROUP BY"),
|
||||
errdetail("Some of the datatypes do not support sorting, which is required for grouping sets.")));
|
||||
use_hashed_grouping = false;
|
||||
}
|
||||
else
|
||||
|
Reference in New Issue
Block a user