| From: | Henson Choi <assam258(at)gmail(dot)com> |
|---|---|
| To: | Tatsuo Ishii <ishii(at)postgresql(dot)org> |
| Cc: | vik(at)postgresfriends(dot)org, er(at)xs4all(dot)nl, jacob(dot)champion(at)enterprisedb(dot)com, david(dot)g(dot)johnston(at)gmail(dot)com, peter(at)eisentraut(dot)org, pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: Row pattern recognition |
| Date: | 2026-03-03 11:32:51 |
| Message-ID: | CAAAe_zCOCYF2_VdvsOn7KY5LwYJ2Tef5huHQV1hK7FJOyVd=3Q@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,Tatsuo
While reviewing the RPR test cases, I noticed that a subquery filter
on RPR window function results silently returns wrong results.
For example, given this query:
SELECT * FROM (
SELECT id, val, COUNT(*) OVER w as cnt
FROM rpr_copy
WINDOW w AS (
ORDER BY id
ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING
PATTERN (A B?)
DEFINE A AS val > 10, B AS val > 20
)
) sub
WHERE cnt > 0
ORDER BY id;
This should return 2 rows, but returns 0 rows instead.
The EXPLAIN plan shows that "cnt > 0" is pushed down into the
WindowAgg node as a Run Condition:
WindowAgg
Run Condition: (count(*) OVER w > 0) <-- pushed down
-> Sort
-> Seq Scan on rpr_copy
I will investigate the cause and work on a fix.
Best regards,
Henson
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Matheus Alcantara | 2026-03-03 11:33:35 | Re: regression tests fails with llvm22 |
| Previous Message | Mahendra Singh Thalor | 2026-03-03 11:17:52 | Re: Non-text mode for pg_dumpall |