From: | Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp> |
---|---|
To: | vik(at)postgresfriends(dot)org, champion(dot)p(at)gmail(dot)com |
Cc: | pgsql-hackers(at)postgresql(dot)org, er(at)xs4all(dot)nl, peter(at)eisentraut(dot)org |
Subject: | Re: Row pattern recognition |
Date: | 2024-04-24 03:12:44 |
Message-ID: | 20240424.121244.752759434415882901.t-ishii@sranhm.sra.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi Vik and Champion,
I think the current RPR patch is not quite correct in handling
count(*).
(using slightly modified version of Vik's example query)
SELECT v.a, count(*) OVER w
FROM (VALUES ('A'),('B'),('B'),('C')) AS v (a)
WINDOW w AS (
ORDER BY v.a
ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING
PATTERN (B+)
DEFINE B AS a = 'B'
)
a | count
---+-------
A | 0
B | 2
B |
C | 0
(4 rows)
Here row 3 is skipped because the pattern B matches row 2 and 3. In
this case I think cont(*) should return 0 rathern than NULL for row 3.
What do you think?
Best reagards,
--
Tatsuo Ishii
SRA OSS LLC
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Kapila | 2024-04-24 03:26:45 | Re: Disallow changing slot's failover option in transaction block |
Previous Message | Tom Lane | 2024-04-24 03:03:40 | Re: Cleanup: remove unused fields from nodes |