public inbox for [email protected]  
help / color / mirror / Atom feed
From: PG Bug reporting form <[email protected]>
To: [email protected]
Cc: [email protected]
Subject: BUG #19535: Splitting window input targets can break same-level SRF lockstep semantics
Date: Wed, 24 Jun 2026 14:46:21 +0000
Message-ID: <[email protected]> (raw)

The following bug has been logged on the website:

Bug reference:      19535
Logged by:          Qifan Liu
Email address:      [email protected]
PostgreSQL version: 18.4
Operating system:   Ubuntu 20.04 x86-64, docker image postgres:18.4
Description:        

## PoC

```sql
WITH source AS (
  SELECT row_number() OVER (
           PARTITION BY generate_series(1, 2)
           ORDER BY generate_series(1, 2)
         ) AS rn,
         generate_series(1, 2) AS g1,
         generate_series(11, 12) AS g2
)
SELECT *
FROM source
ORDER BY rn, g1, g2;

WITH s AS (
  SELECT generate_series(1, 2) AS g1,
         generate_series(11, 12) AS g2
)
SELECT 1::bigint AS rn, g1, g2
FROM s
ORDER BY rn, g1, g2;

EXPLAIN (COSTS OFF)
WITH source AS (
  SELECT row_number() OVER (
           PARTITION BY generate_series(1, 2)
           ORDER BY generate_series(1, 2)
         ) AS rn,
         generate_series(1, 2) AS g1,
         generate_series(11, 12) AS g2
)
SELECT *
FROM source
ORDER BY rn, g1, g2;
```

## Expected Behavior

The two same-level SRFs should run in lockstep, yielding:

```text
1 | 1 | 11
1 | 2 | 12
```

## Actual Behavior

The query returns four rows instead of two:

```text
1 | 1 | 11
1 | 1 | 12
1 | 2 | 11
1 | 2 | 12
```

The plan shows one `ProjectSet` below `WindowAgg` and another above it,
which breaks same-level SRF lockstep semantics.








view thread (2+ messages)  latest in thread

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: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: BUG #19535: Splitting window input targets can break same-level SRF lockstep semantics
  In-Reply-To: <[email protected]>

* 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