Re: Row pattern recognition

From: Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp>
To: vik(at)postgresfriends(dot)org
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Row pattern recognition
Date: 2023-06-28 12:17:00
Message-ID: 20230628.211700.191321983330956034.t-ishii@sranhm.sra.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Small question.

> This query (with all the defaults made explicit):
>
> SELECT s.company, s.tdate, s.price,
> FIRST_VALUE(s.tdate) OVER w,
> LAST_VALUE(s.tdate) OVER w,
> lowest OVER w
> FROM stock AS s
> WINDOW w AS (
> PARTITION BY s.company
> ORDER BY s.tdate
> ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING
> EXCLUDE NO OTHERS
> MEASURES
> LAST(DOWN) AS lowest
> AFTER MATCH SKIP PAST LAST ROW
> INITIAL PATTERN (START DOWN+ UP+)
> DEFINE
> START AS TRUE,
> UP AS price > PREV(price),
> DOWN AS price < PREV(price)
> );

> LAST(DOWN) AS lowest

should be "LAST(DOWN.price) AS lowest"?

Best reagards,
--
Tatsuo Ishii
SRA OSS LLC
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Terry Brennan 2023-06-28 12:40:21 Re: Request for new function in view update
Previous Message vignesh C 2023-06-28 11:22:38 Re: pg_decode_message vs skip_empty_xacts and xact_wrote_changes