RE: PostgreSQL 10: Segmentation fault when using GROUPING SETS with all unsortable columns

From: Huong Dangminh <huo-dangminh(at)ys(dot)jp(dot)nec(dot)com>
To: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
Cc: "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Hiroshi Yanagisawa <hir-yanagisawa(at)ut(dot)jp(dot)nec(dot)com>, Andres Freund <andres(at)anarazel(dot)de>
Subject: RE: PostgreSQL 10: Segmentation fault when using GROUPING SETS with all unsortable columns
Date: 2018-03-20 21:15:12
Message-ID: 75DB81BEEA95B445AE6D576A0A5C9E936A729772@BPXM05GP.gisp.nec.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Thanks for response and the fix patch.

> >>>>> "Huong" == Huong Dangminh <huo-dangminh(at)ys(dot)jp(dot)nec(dot)com> writes:
>
> Huong> Hi,
>
> Huong> I have found a case which could get segmentation fault when Huong>
> using GROUPING SETS. It occurs when columns in GROUPING SETS are Huong>
> all unsortable but hashable.
>
> Yes, mea culpa. will fix.
>
> BTW, you should have reported this as a bug via the pgsql-bugs list or the
> bug submission form.

Sorry. I will be careful in next time.

> Huong> Attached grouping_sets_segv.zip include module to reproduce this
> Huong> problem.
>
> A much simpler way to reproduce it is to use one of the builtin types that
> isn't sortable (I tend to use xid for testing).

Yeah. I did not realize xid type also do.

> Huong> Not yet fully understand the related commit, but I think it is
> Huong> fine to put ERRCODE_FEATURE_NOT_SUPPORTED error from Huong>
> preprocess_grouping_sets when all columns in GROUPING SETS are Huong>
> unsortable. Is that right?
>
> No, that's definitely wrong. The intent is to be able to generate a hashed
> path in this case, it's just the logic that tries to prefer sorting to hashing
> when the input arrives already sorted is doing the wrong thing for unsortable
> data.

Thanks, It should be like that.
And the patch work fine for me.

---
Thanks and best regards,
Dang Minh Huong
NEC Solution Innovators, Ltd.
http://www.nec-solutioninnovators.co.jp/en/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Merlin Moncure 2018-03-20 21:19:10 Re: INOUT parameters in procedures
Previous Message Andres Freund 2018-03-20 21:14:23 Re: [HACKERS] taking stdbool.h into use