public inbox for [email protected]  
help / color / mirror / Atom feed
BUG #19535: Splitting window input targets can break same-level SRF lockstep semantics
2+ messages / 2 participants
[nested] [flat]

* BUG #19535: Splitting window input targets can break same-level SRF lockstep semantics
@ 2026-06-24 14:46 PG Bug reporting form <[email protected]>
  2026-06-29 23:32 ` Re: BUG #19535: Splitting window input targets can break same-level SRF lockstep semantics David Rowley <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: PG Bug reporting form @ 2026-06-24 14:46 UTC (permalink / raw)
  To: [email protected]; +Cc: [email protected]

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.








^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #19535: Splitting window input targets can break same-level SRF lockstep semantics
  2026-06-24 14:46 BUG #19535: Splitting window input targets can break same-level SRF lockstep semantics PG Bug reporting form <[email protected]>
@ 2026-06-29 23:32 ` David Rowley <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: David Rowley @ 2026-06-29 23:32 UTC (permalink / raw)
  To: [email protected]; [email protected]

On Sun, 28 Jun 2026 at 00:55, PG Bug reporting form
<[email protected]> wrote:
> ## 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.

Thanks for the report.  This is the same as what was discussed in bug
#17502.  There was a patch there to disallow SRFs in the WindowClause.
I believe it was intended to go into master only, but that wasn't
done.

David

[1] https://postgr.es/m/flat/17502-281a7aaacfaa872a%40postgresql.org






^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2026-06-29 23:32 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-06-24 14:46 BUG #19535: Splitting window input targets can break same-level SRF lockstep semantics PG Bug reporting form <[email protected]>
2026-06-29 23:32 ` David Rowley <[email protected]>

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