pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Sebastian P. Luque <spluque@gmail.com>
To: pgsql-general@postgresql.org
Subject: Re: custom average window function failure
Date: Sun, 09 Oct 2016 22:10:22 -0500
Message-ID: <87a8ecvqzl.fsf@otaria.sebmel.org> (raw)
References: <87int2qkat.fsf@gmail.com>
	<19183.1476027964@sss.pgh.pa.us>
	<1156e81d-0903-f453-6751-347d5105d4ca@aklaver.com>
	<4302.1476031209@sss.pgh.pa.us>
	<87eg3puxif.fsf@otaria.sebmel.org>
	<12651.1476043221@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-general>

On Sun, 09 Oct 2016 16:00:21 -0400,
Tom Lane <tgl@sss.pgh.pa.us> wrote:

> "Sebastian P. Luque" <spluque@gmail.com> writes:
>> Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>> On closer inspection, the error is only in the
>>> aggregate-used-as-window-function case, not plain aggregation.

>> Yes, I see the same phenomenon.  Could someone suggest a workaround
>> until this is fixed?  I'm under the gun to submit output tables and
>> the only thing I can think of is a crawling slow loop to step through
>> each window twice: once using the plain aggregation and another
>> without just get all rows.  I highly doubt it will be worthwhile,
>> given it's going to be about 1000 iterations, and each one would take
>> about 30-45 min...

> Are you in a position to apply patches?  It's a one-line fix:
> https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=dca25c2562199ce1e7e26367613912a8e...

> Alternatively, the problem doesn't manifest when the aggregate
> transtype and output type are the same, so you could probably refactor
> your code to use plain array_agg and apply the finalfunc separately in
> the SQL query.

Perfect, I'll try the latter option on this one.  Thanks so much to both
of you for your prompt feedback!

-- 
Seb



-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



view thread (15+ messages)  latest in thread

Message-ID: <87a8ecvqzl.fsf@otaria.sebmel.org>
Permalink:  ../87a8ecvqzl.fsf@otaria.sebmel.org/
Also on:    postgresql.org/message-id/87a8ecvqzl.fsf@otaria.sebmel.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: spluque@gmail.com
  Subject: Re: custom average window function failure
  In-Reply-To: <87a8ecvqzl.fsf@otaria.sebmel.org>
  References: <87int2qkat.fsf@gmail.com> <19183.1476027964@sss.pgh.pa.us> <1156e81d-0903-f453-6751-347d5105d4ca@aklaver.com> <4302.1476031209@sss.pgh.pa.us> <87eg3puxif.fsf@otaria.sebmel.org> <12651.1476043221@sss.pgh.pa.us> <87a8ecvqzl.fsf@otaria.sebmel.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox