pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andreas Seltenreich <andreas.seltenreich@credativ.de>
To: Michael Paquier <michael.paquier@gmail.com>
Cc: Bernd Helmle <mailings@oopsware.de>
Cc: Peter Geoghegan <pg@bowt.ie>
Cc: PostgreSQL mailing lists <pgsql-bugs@postgresql.org>
Subject: Re: PostgreSQL crashes with SIGSEGV
Date: Thu, 14 Dec 2017 19:47:08 +0100
Message-ID: <87po7hm9jn.fsf@credativ.de> (raw)
In-Reply-To: <CAB7nPqTq8tVXGLQvTBJTYC5u8k__AF6nDNNNxOS=hP+tpCKxsQ@mail.gmail.com>
References: <1512661638.9720.34.camel@oopsware.de>
	<CAH2-WznDBGQXBE=n3vXWLDomjAbJQz15xK3+hxh-Y92F0eTaBg@mail.gmail.com>
	<1512724784.9720.39.camel@oopsware.de>
	<CAB7nPqTq8tVXGLQvTBJTYC5u8k__AF6nDNNNxOS=hP+tpCKxsQ@mail.gmail.com>

Michael Paquier writes:

> Not sure if you can provide this information, but what does the plan
> of the query look like?

We did some more reducing work on the original query and data.  The
following testcase reproduces the double free reported by valgrind for
me when run against a vanilla REL9_6_STABLE build.

regards,
Andreas

--8<---------------cut here---------------start------------->8---
drop table if exists bug;
create table bug (n text, v text, b text, t text);
insert into bug
   select i%9, i%9, i%16 ,i%4096 from generate_series(1,100000) g(i);
analyze bug;

explain select * from (
select thecube.nv
   from ( select
            (n || ' ') || coalesce(v, '') as nv
           from bug
           group by ((n || ' ') || coalesce(v, '')) ,cube(b, t)
	  ) thecube
	 where nv = '8 8'
) sub limit 7000;
--8<---------------cut here---------------end--------------->8---

                                            QUERY PLAN
---------------------------------------------------------------------------------------------------
 Limit  (cost=13422.32..15747.28 rows=7000 width=32)
   ->  Subquery Scan on thecube  (cost=13422.32..27622.49 rows=42754 width=32)
         ->  GroupAggregate  (cost=13422.32..27194.95 rows=42754 width=38)
               Group Key: (((bug.n || ' '::text) || COALESCE(bug.v, ''::text))), bug.b, bug.t
               Group Key: (((bug.n || ' '::text) || COALESCE(bug.v, ''::text))), bug.b
               Group Key: (((bug.n || ' '::text) || COALESCE(bug.v, ''::text)))
               Sort Key: (((bug.n || ' '::text) || COALESCE(bug.v, ''::text))), bug.t
                 Group Key: (((bug.n || ' '::text) || COALESCE(bug.v, ''::text))), bug.t
               Filter: ((((bug.n || ' '::text) || COALESCE(bug.v, ''::text))) = '8 8'::text)
               ->  Sort  (cost=13422.32..13672.32 rows=100000 width=42)
                     Sort Key: (((bug.n || ' '::text) || COALESCE(bug.v, ''::text))), bug.b, bug.t
                     ->  Seq Scan on bug  (cost=0.00..2041.00 rows=100000 width=42)





view thread (33+ messages)  latest in thread

Message-ID: <87po7hm9jn.fsf@credativ.de>
Permalink:  ../87po7hm9jn.fsf@credativ.de/
Also on:    postgresql.org/message-id/87po7hm9jn.fsf@credativ.de

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: andreas.seltenreich@credativ.de, michael.paquier@gmail.com, mailings@oopsware.de, pg@bowt.ie
  Subject: Re: PostgreSQL crashes with SIGSEGV
  In-Reply-To: <87po7hm9jn.fsf@credativ.de>

* 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