agora inbox for pgsql-bugs@postgresql.org  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: exclusion@gmail.com
Subject: BUG #19684: Assertion in tuplesort_begin_heap() falsified by parallel plan with sort
Date: Fri, 11 Sep 2026 20:00:01 +0000
Message-ID: <19684-fa0b7fdc7d235fd9@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      19684
Logged by:          Alexander Lakhin
Email address:      exclusion@gmail.com
PostgreSQL version: 19beta3
Operating system:   Ubuntu 24.04
Description:        

The following script:
SET cpu_tuple_cost = 1000;
SET min_parallel_table_scan_size = 1;

CREATE TABLE t(i int);
SELECT FROM t UNION SELECT FROM t;

triggers:
TRAP: failed Assert("nkeys > 0"), File: "tuplesortvariants.c", Line: 195,
PID: 1465852

EXPLAIN shows:
                                          QUERY PLAN
-----------------------------------------------------------------------------------------------
 Unique  (cost=3188844.07..3188856.82 rows=2 width=0)
   ->  Sort  (cost=3188844.07..3188856.82 rows=5100 width=0)
         ->  Gather  (cost=1000.00..3188530.00 rows=5100 width=0)
               Workers Planned: 2
               ->  Parallel Append  (cost=0.00..3187020.00 rows=2124
width=0)
                     ->  Parallel Seq Scan on t  (cost=0.00..1062510.00
rows=1062 width=0)
                     ->  Parallel Seq Scan on t t_1  (cost=0.00..1062510.00
rows=1062 width=0)

Without asserts enabled, SELECT succeeds and EXPLAIN (ANALYZE) shows the
same plan.

Reproduced starting from 66c0185a3/12933dc60.








view thread (5+ messages)  latest in thread

Message-ID: <19684-fa0b7fdc7d235fd9@postgresql.org>
Permalink:  ../19684-fa0b7fdc7d235fd9@postgresql.org/
Also on:    postgresql.org/message-id/19684-fa0b7fdc7d235fd9@postgresql.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 using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, exclusion@gmail.com
  Subject: Re: BUG #19684: Assertion in tuplesort_begin_heap() falsified by parallel plan with sort
  In-Reply-To: <19684-fa0b7fdc7d235fd9@postgresql.org>

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

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