Re: Tuple sort is broken. It crashes on simple test.

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Mithun Cy <mithun(dot)cy(at)enterprisedb(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, pg(at)heroku(dot)com
Subject: Re: Tuple sort is broken. It crashes on simple test.
Date: 2017-01-16 11:48:02
Message-ID: CAB7nPqTKDvq42_SHpRU8m6M0KaJGy-3TGkot3mptEHS6JKV6yA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

(Adding Peter in CC who also worked on that)

On Mon, Jan 16, 2017 at 7:14 PM, Mithun Cy <mithun(dot)cy(at)enterprisedb(dot)com> wrote:
> Test:
> ------
> create table seq_tab(t int);
> insert into seq_tab select generate_series(1, 10000000);
> select count(distinct t) from seq_tab;
>
> #0 0x000000000094a9ad in pfree (pointer=0x0) at mcxt.c:1007
> #1 0x0000000000953be3 in mergeonerun (state=0x1611450) at tuplesort.c:2803
> #2 0x0000000000953824 in mergeruns (state=0x1611450) at tuplesort.c:2721
> #3 0x00000000009521bc in tuplesort_performsort (state=0x1611450) at
> tuplesort.c:1813
> #4 0x0000000000662b85 in process_ordered_aggregate_single
> (aggstate=0x160b540, pertrans=0x160d440, pergroupstate=0x160d3f0) at
> nodeAgg.c:1178
> #5 0x00000000006636e0 in finalize_aggregates (aggstate=0x160b540,
> peraggs=0x160c5e0, pergroup=0x160d3f0, currentSet=0) at nodeAgg.c:1600
> #6 0x0000000000664509 in agg_retrieve_direct (aggstate=0x160b540) at
> nodeAgg.c:2266
> #7 0x0000000000663f66 in ExecAgg (node=0x160b540) at nodeAgg.c:1946
> #8 0x0000000000650ad2 in ExecProcNode (node=0x160b540) at execProcnode.c:503

Indeed. It crashes for me immediately by adding an ORDER BY:
select count(distinct t) from seq_tab order by 1;
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2017-01-16 12:11:34 Re: Parallel Index Scans
Previous Message Thomas Munro 2017-01-16 11:04:43 Re: An isolation test for SERIALIZABLE READ ONLY DEFERRABLE