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 1wZkmO-001GCX-15 for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Jun 2026 07:33:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wZkmM-0054ew-2v for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Jun 2026 07:33:42 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wZkmM-0054el-1p for pgsql-hackers@lists.postgresql.org; Wed, 17 Jun 2026 07:33:42 +0000 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wZkmK-00000000sEc-2IA4 for pgsql-hackers@postgresql.org; Wed, 17 Jun 2026 07:33:42 +0000 Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-bec423a5265so988419566b.1 for ; Wed, 17 Jun 2026 00:33:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1781681619; cv=none; d=google.com; s=arc-20240605; b=WNCX/uri1w4FX+X9ZZ4XBkUCkvm2B0xklF2t6OSfA5fWr5faGHzjBWlEdRofPzDLfG yWt1baKaaUp6C8JuPw8eZzX8VrDfWEmUVVNa93g5rFdwZh2x9gSmDSEDneYGdiGIO17s raRADKSSXg1Q2z4BcnoB0udy/9dCYK9XwH9lcJYsx5mm7aSg9OL1MFGp2R99m/Qn7Jh2 6neUtOyj0zSbuCuwGXsjaS6B+Q7yZgpJnls9BKyc15PuamGmyRm9+rQXM6BdSsydrbsv rutcS7hB6lkEsQgacWTMWm2SOcxReB1Kz04NPH0JO6Aizq606GeVFHX8XmVJad/Pl7Mc t0VA== 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=0kqu21ip61yiOD+yxmpxIrAs4K6qk1E8LN0ANLJ2+F0=; fh=WiYYf3JbJs8x6YKbEq4Fe8NDfiMmwE8qB5ES7jymb/w=; b=f8raM4nlHVWIyAkUPK7pgcQxV9ujBvff7fiI4HGtKqxPhOI0V27incL4F2Os+gBWWZ KHmVrcodw0PLJdd+Zv1NgE8P4c6+fQWz90QzdipEbtrPefAECvse5MdtHjfvRZdQkLbZ XRFT35KnSdm6a59K8+LsGXqookbduo1MWynAIewMSy9CVT/wsYfuMu/EsY14vRDJZ+yP Kq3rTuuemwJ8PTYvIOU4DVeteLm6hpCaZfwppLShmtod4XkMIN/kr5rzUxX+HN1CXnPz o9JuL+LaP1ZRbN9hDnlP+cjw0xlG/WfJaEht1zkieAwQk46Veo+drITFjk/XRgZRgddQ ac4w==; 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=1781681619; x=1782286419; 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=0kqu21ip61yiOD+yxmpxIrAs4K6qk1E8LN0ANLJ2+F0=; b=Pgn2SJX9DUD6rRHMZYVn1ZKuj8L0tLmJLv9N6LUSSvOYh7utReWPx2XJ0KejDrTvyg v+0frm6WkQm70pqYw2F5r5eE6i3EASnchdCq3a3f1EB/i+4ucK1JvxWAPHVUIN0OtPIj UksckWcurnyfNWA6AUQR3+oQ+8e3SHW9n67ma0pW8S6ECRSnW0XjfTFdmSSGa04N/W4K y57WFmRgs+5qpyr+PsMbuZEStCaxJUrVizT23VwAOWq7CQxAFuWx1l5ZVEFKageQYu0B 5KEAngBDUiwrr/jxGeRsfNubow/aKfCHxXZcaM9LMlCj63iM40zONdBRvPo6ZYa18VWU u8kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781681619; x=1782286419; 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=0kqu21ip61yiOD+yxmpxIrAs4K6qk1E8LN0ANLJ2+F0=; b=MHJc19ZSoUxR5LnMLEvsOqfSBTENIkhS5xp5ouR/NfOxQ0ecY8j1Tuc8xs+640z374 MS8GZDgnXiGUBkJLcptFVXNoF+zhs+EASkD/XZ6FnJMUFL0rFMNg6v3yPROUitOhVaJD m4jL0/R6HgljhhwKA7Wwe9Sih/WXebu3weDNKOtY4qnojVi4AeI5ly/AEredN/nnRPfP EZqBIRCo5MZBEokd85uwXybvAKtiMMPP7gdbUtzYKE+Vxe8MvGFGhgGPR7qcWOCDPb1E Aypv48boNG0TPa3W0D4u6Ji9nplfIg0M79KWazRLAmDlpg4NZVmWez5MKzIbjVgYapSm Xxbg== X-Forwarded-Encrypted: i=1; AFNElJ8v/DxiqlLmRbiTuL+TAKlXgYyoWzDOLpfq8481cc2pYKWxofp897XI8rRsy4skg8N5knSZvimfWU5vAKRV@postgresql.org X-Gm-Message-State: AOJu0Yw/YH3zZIWDSXfkgMyqQD928YFcyZxeBb6hZx+grd/t1mrIFx99 UjE9xImYZKureAftb+ILe4s3Hibp4+CET+hnx4iICsRBgyo1fozNNHWRZUWlhH1zCAPAmEOuZYX rMY04i//9yL7HOJgVfqycQ5zjQO1fJmo= X-Gm-Gg: Acq92OEbnO1JxZAUC3dAHxcyZ6DAHA3mY9b0pUqE2ZAb7sCHia4MjZgWRu7ZBC08P3b tDz0sVezqLSBrQY8Ts0XWJpi/0hZVqnh+3c0QbnCrvwy772vT+FevyscRaNBNkuKj1fu1CSg0fK vbnSICaygc2gC9aFfPFRuxlE8jMa/Sl4SRKAiWP+NIjWfHQPzgseRO2pU3ZAmMFswjBGiPQHrdi xH97Tw2Ziik3RYEqbgECfDck2VogAmocKs0M0lekBMVwtkABy7eYISPTLyS/QH7m0aYTBPOoiby TZ/wp16coLIPKnhLl6BlQHlQ+FjBc++PoQ8E4Z+qXEZr47vDQsXlippe6E1qVyeESsR40DPplQ3 fxtuxu1zC8w== X-Received: by 2002:a17:906:4fcb:b0:bee:b5f2:639d with SMTP id a640c23a62f3a-c05a203a798mr152488066b.10.1781681619205; Wed, 17 Jun 2026 00:33:39 -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, 17 Jun 2026 16:33:26 +0900 X-Gm-Features: AVVi8Cfn1gHa2JTbFYkaNfRtYwt9DgWSwkr8KGv-_qZsfpSCz420tJNLTfsHQ_E 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="00000000000004032d06546e14d1" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000004032d06546e14d1 Content-Type: text/plain; charset="UTF-8" Hi Jian and Tatsuo, Thanks for the patch and the careful review. Tatsuo, item 1 below (attribute notation inside a DEFINE clause) is a question for you; the rest is feedback on Jian's patch. > /* arity: a value expression and an optional offset */ > Typo: arity "arity" may be an unfamiliar term, so I'll reword the comment in plainer language ("takes a value expression and an optional offset"). > Simplify ParseFuncOrColumn: > It now routes to ParseRPRNavCall exclusively when ParseExprKind is > EXPR_KIND_RPR_DEFINE and not column projection and list_length(funcname) > == 1. Original behavior is preserved otherwise. > Centralize error handling: > Treat RPR navigation as FUNCDETAIL_NORMAL to reuse the common error > handling in ParseFuncOrColumn, effectively stripping redundant error > checks from ParseRPRNavCall. I'd take this structural part -- it's a clear cleanup: ParseRPRNavCall drops the duplicated decoration checks while the common path gives the identical messages, with no change in behavior or output. Two user-visible changes in the patch I'd rather settle on their own before taking them: 1. Attribute notation inside a DEFINE clause, e.g. (f).prev. The guard this change removes is one I deliberately left undecided during development (hence the XXX comment), so I'd keep it for now and ask here. Without it, (f).prev with no such field gives a generic "column \"prev\" not found ..." instead of the dedicated "cannot use row pattern navigation function PREV in attribute notation". Three options: (a) Treat (f).prev as an ordinary function (prev(f)), the same as outside a DEFINE clause -- which is what the patch does. (b) Treat (f).prev as the navigation function -- read the attribute notation as navigation. An ordinary function of that name is still reachable as public.prev(...). (c) Reject the ambiguous (f).prev with a dedicated error (what is currently committed), rather than resolving it one way or the other. My own leaning is actually (a) -- it keeps attribute notation behaving the same inside and outside a DEFINE clause. (c) is what's in the tree now, and either way it changes the user-visible error and SQLSTATE, so I'd rather settle this explicitly than let the refactor decide it silently. Tatsuo, what do you think? 2. The offset type-mismatch message. The patch rephrases offset argument of %s must be type bigint, not type %s to %s offset argument of type %s cannot be coerced to the expected bigint (+ a hint) The behavior is identical, so I'd keep the original wording. "argument ... must be type X, not type Y" is the established phrasing -- it's what coerce_to_boolean() produces, and the non-boolean DEFINE error in this same feature already uses it. Rewording only the offset message would be inconsistent with that, for no behavioral gain. One small process note: for patches that aren't really being proposed to the list yet -- ones still under review, or throwaway implementations written just to analyze a problem -- could you send them off-list or as a pull request instead? That keeps the thread focused on what's actually being proposed for the patch. Best regards, Henson --00000000000004032d06546e14d1 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Jian and Tatsuo,

Thanks for the= patch and the careful review.

Tatsuo, item 1 below (attribute notat= ion inside a DEFINE clause) is a
question for you; the rest is feedback = on Jian's patch.

> /* arity: a value expression and an option= al offset */
> Typo: arity

"arity" may be an unfamil= iar term, so I'll reword the comment in plainer
language ("take= s a value expression and an optional offset").

> Simplify Pa= rseFuncOrColumn:
> It now routes to ParseRPRNavCall exclusively when = ParseExprKind is
> EXPR_KIND_RPR_DEFINE and not column projection and= list_length(funcname)
> =3D=3D 1. Original behavior is preserved oth= erwise.
> Centralize error handling:
> Treat RPR navigation as = FUNCDETAIL_NORMAL to reuse the common error
> handling in ParseFuncOr= Column, effectively stripping redundant error
> checks from ParseRPRN= avCall.

I'd take this structural part -- it's a clear cleanu= p: ParseRPRNavCall
drops the duplicated decoration checks while the comm= on path gives the
identical messages, with no change in behavior or outp= ut.

Two user-visible changes in the patch I'd rather settle on t= heir own
before taking them:

1. Attribute notation inside a DEFIN= E clause, e.g. (f).prev.

=C2=A0 =C2=A0The guard this change removes = is one I deliberately left undecided
=C2=A0 =C2=A0during development (he= nce the XXX comment), so I'd keep it for now and
=C2=A0 =C2=A0ask he= re.=C2=A0 Without it, (f).prev with no such field gives a generic
=C2=A0= =C2=A0"column \"prev\" not found ..." instead of the d= edicated "cannot use
=C2=A0 =C2=A0row pattern navigation function P= REV in attribute notation".=C2=A0 Three
=C2=A0 =C2=A0options:
=C2=A0 =C2=A0(a) Treat (f).prev as an ordinary function (prev(f)), the sa= me as
=C2=A0 =C2=A0 =C2=A0 =C2=A0outside a DEFINE clause -- which is wha= t the patch does.

=C2=A0 =C2=A0(b) Treat (f).prev as the navigation = function -- read the attribute
=C2=A0 =C2=A0 =C2=A0 =C2=A0notation as na= vigation.=C2=A0 An ordinary function of that name is still
=C2=A0 =C2=A0= =C2=A0 =C2=A0reachable as public.prev(...).

=C2=A0 =C2=A0(c) Reject= the ambiguous (f).prev with a dedicated error (what is
=C2=A0 =C2=A0 = =C2=A0 =C2=A0currently committed), rather than resolving it one way or the<= br>=C2=A0 =C2=A0 =C2=A0 =C2=A0other.

=C2=A0 =C2=A0My own leaning is = actually (a) -- it keeps attribute notation behaving
=C2=A0 =C2=A0the sa= me inside and outside a DEFINE clause. =C2=A0(c) is what's in the tree<= br>=C2=A0 =C2=A0now, and either way it changes the user-visible error and S= QLSTATE, so
=C2=A0 =C2=A0I'd rather settle this explicitly than let = the refactor decide it
=C2=A0 =C2=A0silently.=C2=A0 Tatsuo, what do you = think?

2. The offset type-mismatch message.

=C2=A0 =C2=A0The = patch rephrases

=C2=A0 =C2=A0 =C2=A0offset argument of %s must be ty= pe bigint, not type %s
=C2=A0 =C2=A0to
=C2=A0 =C2=A0 =C2=A0%s offset = argument of type %s cannot be coerced to the expected
=C2=A0 =C2=A0 =C2= =A0bigint =C2=A0 (+ a hint)

=C2=A0 =C2=A0The behavior is identical, = so I'd keep the original wording. =C2=A0"argument
=C2=A0 =C2=A0= ... must be type X, not type Y" is the established phrasing -- it'= s what
=C2=A0 =C2=A0coerce_to_boolean() produces, and the non-boolean DE= FINE error in this
=C2=A0 =C2=A0same feature already uses it.=C2=A0 Rewo= rding only the offset message would
=C2=A0 =C2=A0be inconsistent with th= at, for no behavioral gain.

One small process note: for patches that= aren't really being proposed to
the list yet -- ones still under re= view, or throwaway implementations
written just to analyze a problem -- = could you send them off-list or as a
pull request instead?=C2=A0 That ke= eps the thread focused on what's actually
being proposed for the pat= ch.

Best regards,
Henson
--00000000000004032d06546e14d1--