Re: failures with tuplesort and ordered set aggregates (due to 5cefbf5a6c44)

From: Peter Geoghegan <pg(at)heroku(dot)com>
To: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: failures with tuplesort and ordered set aggregates (due to 5cefbf5a6c44)
Date: 2015-02-20 21:01:17
Message-ID: CAM3SWZSm4GyfjBN1VmzzbtPXK7N53LVEKprJwkW8LBc=UkAMHg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Feb 20, 2015 at 11:58 AM, Tomas Vondra
<tomas(dot)vondra(at)2ndquadrant(dot)com> wrote:
> This seems to happen because ordered_set_startup() calls
> tuplesort_begin_datum() when (use_tuples == true), which only sets
> 'onlyKey' and leaves (sortKeys == NULL). So 'mergeruns' fails because it
> does not expect that.

Oops. You're right. Attached patch fixes the issue, by making
tuplesort_begin_datum() consistent with other comparable routines for
other tuple cases. I think it makes sense to have the 'sortKeys' field
always set, and the 'onlyKey' field also set when that additional
optimization makes sense. That was what I understood the API to be, so
arguably this is a pre-existing issue with tuplesort_begin_datum().

Thanks for the report!
--
Peter Geoghegan

Attachment Content-Type Size
fix_datumsort_fieled.patch text/x-patch 1.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Eric Grinstein 2015-02-20 21:05:13 Idea: GSoC - Query Rewrite with Materialized Views
Previous Message Tomas Vondra 2015-02-20 20:57:00 Re: Re: Abbreviated keys for Datum tuplesort