Re: Row pattern recognition

Поиск
Список
Период
Сортировка
Искать
От
Tatsuo Ishii
Тема
Re: Row pattern recognition
Дата
Msg-id
20240424.121244.752759434415882901.t-ishii@sranhm.sra.co.jp
Ответ на
Список
Дерево обсуждения
Re: Row pattern recognition Tatsuo Ishii <ishii@sraoss.co.jp>
Re: Row pattern recognition Peter Eisentraut <peter@eisentraut.org>
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


В списке pgsql-hackers по дате отправления
От: Tom Lane
Дата:
От: Amit Kapila
Дата:
FAQ