pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@2ndquadrant.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: terje@elde.net
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #8410: out of binary heap slots
Date: Sat, 31 Aug 2013 01:55:54 +0200
Message-ID: <20130830235553.GB11360@awork2.anarazel.de> (raw)
In-Reply-To: <22999.1377905319@sss.pgh.pa.us>
References: <E1VFVaN-000679-Mj@wrigleys.postgresql.org>
	<20130830210015.GA8932@awork2.anarazel.de>
	<20130830210525.GB8932@awork2.anarazel.de>
	<20130830214429.GE8932@awork2.anarazel.de>
	<22149.1377903353@sss.pgh.pa.us>
	<20130830231231.GC1138@awork2.anarazel.de>
	<22999.1377905319@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

On 2013-08-30 19:28:39 -0400, Tom Lane wrote:
> Andres Freund <andres@2ndquadrant.com> writes:
> > On 2013-08-30 18:55:53 -0400, Tom Lane wrote:
> >> Not sure.  It's pretty disturbing that this wasn't caught earlier;
> >> it seems to me that means there's no regression coverage that hits
> >> ExecReScanMergeAppend.  However, I don't much like this specific test case
> >> because it seems like hitting the bug could depend on what series of
> >> random values you get.
> 
> > Hm, that should be fixable. How about:
> 
> Looks good, applied.

On second thought, it might not be so good looking - the queries results
are independent of the data from merge-append. So we only check that we
don't crash and not that the results make any sense. How about the
attached patch?
I verified that it fails without the binaryheap_reset().

Greetings,

Andres Freund

-- 
 Andres Freund	                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

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

Attachments:

0001-Improve-regression-test-for-8410.patch (text/x-patch, 4.3K) download From 14f521d9e2e9efde8b19a1664b2cf2056a2e9520 Mon Sep 17 00:00:00 2001 From: Andres Freund <andres@anarazel.de> Date: Sat, 31 Aug 2013 01:54:05 +0200 Subject: [PATCH] Improve regression test for #8410 The previous version of the query disregarded the result of the MergeAppend instead of checking its results. --- src/test/regress/expected/inherit.out | 49 +++++++++++++++++------------------ src/test/regress/sql/inherit.sql | 16 ++++++------ 2 files changed, 32 insertions(+), 33 deletions(-) diff --git a/src/test/regress/expected/inherit.out b/src/test/regress/expected/inherit.out index 8520281..a2ef7ef 100644 --- a/src/test/regress/expected/inherit.out +++ b/src/test/regress/expected/inherit.out @@ -1353,42 +1353,41 @@ ORDER BY x, y; -- exercise rescan code path via a repeatedly-evaluated subquery explain (costs off) SELECT - (SELECT g.i FROM ( - (SELECT * FROM generate_series(1, 2) ORDER BY 1) + ARRAY(SELECT f.i FROM ( + (SELECT d + g.i FROM generate_series(4, 30, 3) d ORDER BY 1) UNION ALL - (SELECT * FROM generate_series(1, 2) ORDER BY 1) + (SELECT d + g.i FROM generate_series(0, 30, 5) d ORDER BY 1) ) f(i) - ORDER BY f.i LIMIT 1) + ORDER BY f.i LIMIT 10) FROM generate_series(1, 3) g(i); - QUERY PLAN ------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------- Function Scan on generate_series g SubPlan 1 -> Limit - -> Result - -> Merge Append - Sort Key: generate_series.generate_series - -> Sort - Sort Key: generate_series.generate_series - -> Function Scan on generate_series - -> Sort - Sort Key: generate_series_1.generate_series - -> Function Scan on generate_series generate_series_1 -(12 rows) + -> Merge Append + Sort Key: ((d.d + g.i)) + -> Sort + Sort Key: ((d.d + g.i)) + -> Function Scan on generate_series d + -> Sort + Sort Key: ((d_1.d + g.i)) + -> Function Scan on generate_series d_1 +(11 rows) SELECT - (SELECT g.i FROM ( - (SELECT * FROM generate_series(1, 2) ORDER BY 1) + ARRAY(SELECT f.i FROM ( + (SELECT d + g.i FROM generate_series(4, 30, 3) d ORDER BY 1) UNION ALL - (SELECT * FROM generate_series(1, 2) ORDER BY 1) + (SELECT d + g.i FROM generate_series(0, 30, 5) d ORDER BY 1) ) f(i) - ORDER BY f.i LIMIT 1) + ORDER BY f.i LIMIT 10) FROM generate_series(1, 3) g(i); - i ---- - 1 - 2 - 3 + array +------------------------------ + {1,5,6,8,11,11,14,16,17,20} + {2,6,7,9,12,12,15,17,18,21} + {3,7,8,10,13,13,16,18,19,22} (3 rows) reset enable_seqscan; diff --git a/src/test/regress/sql/inherit.sql b/src/test/regress/sql/inherit.sql index e88a584..8637655 100644 --- a/src/test/regress/sql/inherit.sql +++ b/src/test/regress/sql/inherit.sql @@ -442,21 +442,21 @@ ORDER BY x, y; -- exercise rescan code path via a repeatedly-evaluated subquery explain (costs off) SELECT - (SELECT g.i FROM ( - (SELECT * FROM generate_series(1, 2) ORDER BY 1) + ARRAY(SELECT f.i FROM ( + (SELECT d + g.i FROM generate_series(4, 30, 3) d ORDER BY 1) UNION ALL - (SELECT * FROM generate_series(1, 2) ORDER BY 1) + (SELECT d + g.i FROM generate_series(0, 30, 5) d ORDER BY 1) ) f(i) - ORDER BY f.i LIMIT 1) + ORDER BY f.i LIMIT 10) FROM generate_series(1, 3) g(i); SELECT - (SELECT g.i FROM ( - (SELECT * FROM generate_series(1, 2) ORDER BY 1) + ARRAY(SELECT f.i FROM ( + (SELECT d + g.i FROM generate_series(4, 30, 3) d ORDER BY 1) UNION ALL - (SELECT * FROM generate_series(1, 2) ORDER BY 1) + (SELECT d + g.i FROM generate_series(0, 30, 5) d ORDER BY 1) ) f(i) - ORDER BY f.i LIMIT 1) + ORDER BY f.i LIMIT 10) FROM generate_series(1, 3) g(i); reset enable_seqscan; -- 1.8.2.rc2.4.g7799588.dirty

view thread (20+ messages)  latest in thread

Message-ID: <20130830235553.GB11360@awork2.anarazel.de>
Permalink:  ../20130830235553.GB11360@awork2.anarazel.de/
Also on:    postgresql.org/message-id/20130830235553.GB11360@awork2.anarazel.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 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-bugs@postgresql.org
  Cc: andres@2ndquadrant.com, tgl@sss.pgh.pa.us, terje@elde.net
  Subject: Re: BUG #8410: out of binary heap slots
  In-Reply-To: <20130830235553.GB11360@awork2.anarazel.de>
  References: <E1VFVaN-000679-Mj@wrigleys.postgresql.org> <20130830210015.GA8932@awork2.anarazel.de> <20130830210525.GB8932@awork2.anarazel.de> <20130830214429.GE8932@awork2.anarazel.de> <22149.1377903353@sss.pgh.pa.us> <20130830231231.GC1138@awork2.anarazel.de> <22999.1377905319@sss.pgh.pa.us> <20130830235553.GB11360@awork2.anarazel.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