public inbox for [email protected]  
help / color / mirror / Atom feed
From: Tatsuo Ishii <[email protected]>
To: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Subject: Re: Row pattern recognition
Date: Thu, 12 Feb 2026 10:17:01 +0900 (JST)
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<CAAAe_zDX24SnaQFwTNVUx_vK5887mpD+rXTaedjzdfFrGROFGA@mail.gmail.com>
	<[email protected]>

Hi Henson,

I found following in rpr_base.sql:

-- {0} is not allowed (min must be >= 1)
SELECT id, val, COUNT(*) OVER w as cnt
FROM rpr_quant
WINDOW w AS (
    ORDER BY id
    ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING
    PATTERN (A{0} B)
    DEFINE A AS val > 1000, B AS val > 0
)
ORDER BY id;

However in my uderstanding the SQL standard allows A{0}.

PATTERN (A{0} B)
is equivalant to:
PATTERN (B)

Another interesting PATTERN is:

A{,}

This is equivalant to A{0,}

BTW, after studied this more, I found that A{0,0} is not allowed. In
this form the right hand side number shall be greater than 0. From
ISO/IEC 9075-2 7.9 <row pattern syntax> "Syntax Rules 20)

"If <left brace> <unsigned integer> <comma> <unsigned integer> <right
brace> is specified, then let VUI1 and VUI2 be the values of the first
and second <unsigned integer>'s, respectively. VUI1 shall be less than
or equal to VUI2, and VUI2 shall be greater than 0 (zero)."

However according to the Google, Oracle and Snowflake allows A{0,0}:
they break the standard. So, what do you think PostgreSQL should do
here?  My preference is "always follow the standard". But others might
think differently.

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






reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Row pattern recognition
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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