Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wWyBE-002yeL-00 for pgsql-hackers@arkaria.postgresql.org; Tue, 09 Jun 2026 15:15:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wWyBC-007XOB-2y for pgsql-hackers@arkaria.postgresql.org; Tue, 09 Jun 2026 15:15:50 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wWyBC-007XO3-1b for pgsql-hackers@lists.postgresql.org; Tue, 09 Jun 2026 15:15:50 +0000 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wWyB8-00000001rsV-3CKQ for pgsql-hackers@postgresql.org; Tue, 09 Jun 2026 15:15:49 +0000 Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-bec354815b9so584743766b.3 for ; Tue, 09 Jun 2026 08:15:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1781018144; cv=none; d=google.com; s=arc-20240605; b=cgFLbnA+5Rp/HE72TzILIEXTKVhaoob2cMX0ztF8M+8/2rFTE22BzihX14i2KN908W cqcKPIUA8xUOKonc3pvE8BQnYYgdLh1sCc3v5Qw/Nns0EmJfl1P1YMsN2FImp7GRnPJH 2bIPUFGoOb35pmcjQQPA+o4ypv/2nzNncUcWmIL/IKclJ0nQzwB3BpQ9G5E9vF6qi+e4 jq9OqigP21cw9J1w94AzcydxdjGZSijcXXPq8NAwVq3Dt81+Zlm9omJkdmDqNvqgT9de Td3aVde+zeBEVeOaY3wL0Wza3gLWVC6+mRtaff1RfU3/UQs6rZ94Bg5HL9Sdv4o/7dr0 BXIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:reply-to:in-reply-to:references :mime-version:dkim-signature; bh=5KKUKy7xzlNAiEBCgWjKLfvTWEukp0Xe9ptNCqxvWbc=; fh=P23fS9RnJbuaaHhHE9I7AKT4S2TZkzDZEUEv6yTQVCY=; b=Qb8TAZYT+aqCY7Q5NEsMwNqZRMtDstR9HA9PE8XcNfLmgvfzqsmQL1SX+T4fqO7Io6 zLo2ipeACGVmnEhYF9/P/Qz2TudJ0hLxxLYlufLc2qvsa4vmqcdKcDY/VnJ4iuZC9sxH 0EdZ755/DRbKBHmi1qnVy0T97kTmFIELdmLpvBxLyDZpP2GY9UOiaSy7a3o185cjbuIW 7aZ2QygCzDdqS3pZTwPGBkTBVK8LYOXzAqK+8KfxswydNhpJsdLld+hdUaEs2tpzCnEj XHSPmmwH+ApEe6LckEM+LqR82cW2Ba0x9/GQpm1TXlJilgq5rf8oY81Fso5/6R0k6shy k1WA==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781018144; x=1781622944; darn=postgresql.org; h=cc:to:subject:message-id:date:from:reply-to:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=5KKUKy7xzlNAiEBCgWjKLfvTWEukp0Xe9ptNCqxvWbc=; b=gGxYKG6yqHLj2lgg/gvXFm04t0VrJKafYRfachqheHKLr2vAoFomD6UccPYFYpH0SZ c86XjF9QMDqlaX6BS/JZGacB+CS7GBDRFk0g6J+T/MyFUn3Rz0kxD9x99SBf0bjrgEnp kLtm28PfafAkFhH276vzW6Parmm4lTIah7T772NADsqWes3cNJZaAYtzRqAcf2wScFDf ZgnujxTEdZwBs3JUvMjnMQOkq/L/lWGLp7MkR5XHhgWo/voRagzEERPJnNxD+CrbADXK kUSHvpxaeGSVuyXMftsBA/Azf0rjYVnyqacpct3xFUlovP5NuLbWdVyrsn2RYROHU97H FJhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781018144; x=1781622944; h=cc:to:subject:message-id:date:from:reply-to:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=5KKUKy7xzlNAiEBCgWjKLfvTWEukp0Xe9ptNCqxvWbc=; b=R54QEThYKNoTVzNdd/waTyhd+aPsn3ybK4iu+RbCFL4Ns8qgey7syPYwkU6fdOD50d YzkLJ8jm1wbHgjwm/nK57Zb49Hh8UNrH+xOka9ZO6a04d6POneeptbGwjQaUiAIv/AYs OL95WB8wZghLLmZF4v9d1+Xn8AkJPpofOf399LgCQ5a4vOfzyemDv0R98qp2Fmd7FMU8 nslxUr68W+rweQVcY5v9g3N4VZwDNhsck59mqBa4lfCE6Z4hlEMbnhmrDkPh7QCSFwj4 Y+EYPaUQSA3KbF1W9wcji9/edKEhgwwX4vgpklxF655TycKUR1dq74IPPzSKegrKp2fb izxQ== X-Forwarded-Encrypted: i=1; AFNElJ+9kra6tX6RjZyIL2AHg65ybcQARsVye9lHqDDfumAJYmylqQBqO3Uj1z9U7IRgo8d3tSMW4btfoeHNTB01@postgresql.org X-Gm-Message-State: AOJu0YxqIopaR6LW5q5oIssCkV6kTUdiTmAd/85jxMsds2tEcl0h7D7+ felcuMnKBaE63b3jbYNjrvRDkO0ZAAInAkR36BW7LqOChm5UMvU50PNp1q3glze2JUp95zzvskl iRmmeXRxoq+xclDJPKOuZgzlcFbP17XjS2QWMXEk= X-Gm-Gg: Acq92OHZK3x9Sm9gdqNswHiMH92nEQwQRNiW7CAHsa56o9VC+IlthWtSj9QmRxq7u7Z UOwhYcAvq1qPUnihPeQEiMi11v4xjqP/ni44uWg65oh1eF41/Rglvw13+7vg38HQtkjJAVeTjR+ KPZLuMVWc6q4X6FKjxTbgUNcMU2fKi2L2BfQLBhSAyb6UX25Hs4S041Z4ac81WWjAt1pAA4jpHf JPRmRMM9iLKqYUe0/dRYldEMIv1uS5WCd9p7L/PRuqcgrtcUnsWxwjZRyjJwO7t79Tb+s6EMD7K qpejhIZ43PkK97hgkso2OgO7JTW6hJxT7xmBoEJNt/rNGi/Ab3eaoYyO9lR0urNGTGnf79xTluk pjaXWv76/CAs4DMd0Kp5Etlfs5ZgcLFSj X-Received: by 2002:a17:907:72c9:b0:bdb:b76c:4dd0 with SMTP id a640c23a62f3a-bf3733075b0mr1024641666b.40.1781018143606; Tue, 09 Jun 2026 08:15:43 -0700 (PDT) MIME-Version: 1.0 References: <20260604.132108.405136284364833955.ishii@postgresql.org> <20260609.171307.1883356507067957349.ishii@postgresql.org> In-Reply-To: Reply-To: assam258@gmail.com From: Henson Choi Date: Wed, 10 Jun 2026 00:15:31 +0900 X-Gm-Features: AVVi8Cf5srAodeeTniu5MTWRzw-Bt_P_nyRgDRVFIzQWizBGQh3MKVNh5wvhltI Message-ID: Subject: Re: Row pattern recognition To: jian he , Tatsuo Ishii Cc: zsolt.parragi@percona.com, sjjang112233@gmail.com, vik@postgresfriends.org, er@xs4all.nl, jacob.champion@enterprisedb.com, david.g.johnston@gmail.com, peter@eisentraut.org, li.evan.chao@gmail.com, pgsql-hackers@postgresql.org Content-Type: multipart/alternative; boundary="000000000000c9cdc90653d39981" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000c9cdc90653d39981 Content-Type: text/plain; charset="UTF-8" Re: Row pattern recognition To: jian he, Tatsuo Ishii (+ pgsql-hackers) Hi jian, Tatsuo, Thanks for the careful review -- replies inline. One question up front, for Tatsuo: I'd like your take on the LOWPRICE/UP/DOWN casing below (details at that point). The rest are replies to jian's points. > The below in advanced.sgml actually seems better suited for > explain.sgml (which currently has no changes). > At the very least, explain.sgml should mention it. Agreed; I'll move the EXPLAIN marker description over to explain.sgml. > LOWPRICE, UP, DOWN should be lower case, since they are not keywords? They're user identifiers, and the standard and Oracle docs show them in upper case, so I lean toward leaving the example as written -- though EXPLAIN and deparse do lower-case them today. Tatsuo, I'd defer the casing to you. > scanRPRPatternRecursive > It would be better to replace all ``non-trivial quantifier`` to > ``non-trivial quantifier (not {1,1}).`` Agreed, that's clearer; will do. > I want to rename allocateRPRPattern to makeRPRPattern, what do you think? Good idea -- makeRPRPattern fits the makeNode/makeXxx convention. > RPRPatternNode.reluctant_location is not necessary. Agreed. The field is only written and propagated, never read back, so I'll drop it and keep the reluctance as a plain bool. > Is nav_volatile_func_checker really necessary? ... The convention is > not to check expression volatility during parse analysis stage. Good point -- I'll move the volatility rejection out of parse analysis and into the planner, in line with that convention. > query_jumble_ignore is not needed because it's only manipulated in > gram.y ... Right; I'll drop the query_jumble_ignore attribute. > v47-0001 ... Change errmsg to errmsg("invalid token \"%s\" after range > quantifier", $5) will make the error message clearer. Agreed, that reads better; I'll adjust the message accordingly. > v47-0002 ... We should just drop these comments from the regress tests. Agreed -- the internal function names don't belong in the tests; I'll remove them. > v47-0003 ... mutate them in place using list_delete_nth_cell ... > for overflow handling ... pg_mul_s32_overflow, pg_add_s32_overflow. The overflow helpers are a clear win. The in-place list mutation is behavior-equivalent, but I'd rather not reshape that logic right now without a concrete need, so I'll hold off on it for the moment. The new tests are good and I'll fold them in. More broadly, I see the patch as being in its final verification stage at this point, so I'd prefer to limit logic changes to those backed by a clear review or test finding. > v47-0004 ... Some misc refactoring ... Mostly agree -- the rpSkipTo/initial comments read more accurately as flag assignments. I'd keep the "PATTERN AST" wording (it's an AST, not a flag) and the deparse note, but the rest is fine. Best, Henson --000000000000c9cdc90653d39981 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Re: Row pattern recognition
To: jian he, Tatsuo Ishii (= + pgsql-hackers)

Hi jian, Tatsuo,

Thanks for the careful revi= ew -- replies inline. One question up front,
for Tatsuo: I'd like yo= ur take on the LOWPRICE/UP/DOWN casing below
(details at that point). Th= e rest are replies to jian's points.

> The below in advanced.= sgml actually seems better suited for
> explain.sgml (which currently= has no changes).
> At the very least, explain.sgml should mention it= .

Agreed; I'll move the EXPLAIN marker description over to expla= in.sgml.

> LOWPRICE, UP, DOWN should be lower case, since they ar= e not keywords?

They're user identifiers, and the standard and O= racle docs show them in
upper case, so I lean toward leaving the example= as written -- though
EXPLAIN and deparse do lower-case them today. Tats= uo, I'd defer the
casing to you.

> scanRPRPatternRecursive=
> It would be better to replace all ``non-trivial quantifier`` to> ``non-trivial quantifier (not {1,1}).``

Agreed, that's cle= arer; will do.

> I want to rename allocateRPRPattern to makeRPRPa= ttern, what do you think?

Good idea -- makeRPRPattern fits the makeN= ode/makeXxx convention.

> RPRPatternNode.reluctant_location is no= t necessary.

Agreed. The field is only written and propagated, never= read back, so
I'll drop it and keep the reluctance as a plain bool.=

> Is nav_volatile_func_checker really necessary? ... The convent= ion is
> not to check expression volatility during parse analysis sta= ge.

Good point -- I'll move the volatility rejection out of pars= e analysis
and into the planner, in line with that convention.

&g= t; query_jumble_ignore is not needed because it's only manipulated in> gram.y ...

Right; I'll drop the query_jumble_ignore attri= bute.

> v47-0001 ... Change errmsg to errmsg("invalid token = \"%s\" after range
> quantifier", $5) will make the er= ror message clearer.

Agreed, that reads better; I'll adjust the = message accordingly.

> v47-0002 ... We should just drop these com= ments from the regress tests.

Agreed -- the internal function names = don't belong in the tests; I'll
remove them.

> v47-000= 3 ... mutate them in place using list_delete_nth_cell ...
> for overf= low handling ... pg_mul_s32_overflow, pg_add_s32_overflow.

The overf= low helpers are a clear win. The in-place list mutation is
behavior-equi= valent, but I'd rather not reshape that logic right now
without a co= ncrete need, so I'll hold off on it for the moment. The new
tests ar= e good and I'll fold them in.

More broadly, I see the patch as b= eing in its final verification stage
at this point, so I'd prefer to= limit logic changes to those backed by a
clear review or test finding.<= br>
> v47-0004 ... Some misc refactoring ...

Mostly agree -- t= he rpSkipTo/initial comments read more accurately as
flag assignments. I= 'd keep the "PATTERN AST" wording (it's an AST, not a
= flag) and the deparse note, but the rest is fine.

Best,
Henson
--000000000000c9cdc90653d39981--