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 1waMmk-001kYZ-1F for pgsql-hackers@arkaria.postgresql.org; Fri, 19 Jun 2026 00:08:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1waMmj-00E9Zp-0A for pgsql-hackers@arkaria.postgresql.org; Fri, 19 Jun 2026 00:08:37 +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 1waMmi-00E9Zh-20 for pgsql-hackers@lists.postgresql.org; Fri, 19 Jun 2026 00:08:36 +0000 Received: from mail-vs1-xe32.google.com ([2607:f8b0:4864:20::e32]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1waMmf-000000013ZX-3acT for pgsql-hackers@postgresql.org; Fri, 19 Jun 2026 00:08:35 +0000 Received: by mail-vs1-xe32.google.com with SMTP id ada2fe7eead31-7296b265360so370998137.2 for ; Thu, 18 Jun 2026 17:08:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1781827713; cv=none; d=google.com; s=arc-20240605; b=hxKzcWQ/+xLRRkCpxrmsXVnAhfKJJnAUHB5yYNRYxcM/pvQ8P0t333LNETQPuovRLF vyeTabnJZsi0MOjila+W5qeG2wd3c8VqgtejxfdN5+Bp02FsqlBRGGlUs8dSv0vN58zZ cok0IpaqvByjqhaQf4dfw0oLNrX35BPX68wMUa1wteVMFoA3rX9JYxv6FQqGB8mS8w/S XM8uvLie36Sazw8lRNz6SnSjjHGOwCGwC6nn8z0TkUXOg81P9Adsd29bSQBxHbdupTiV OR8dkTBgL7+i6oSQPyKroKaP8F+hhL87CPy5EUD2OR93JXWUwWLCBO1UeWzczyUsPueM yufw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=KuUIvHQjcQDZNnzN1mUyY6SFj6mz0/b2AOdhCSQpHl0=; fh=16gIAjLiYc+7Qoq8zu+f7YHy8cezyFbeKs/9lF0noas=; b=S7pDFuj32N1PkfY+Di0aXzQGgqHJbzMmaLp9OafhhitKrG6Sb//x/8thPLaRsP/L1A HQtISaoYBLXbMt0e1zAkeEixrEZmxpLfz8QHsim1t2i742eIzChy4pHIK1uf1yeGiB8q ZXl2o1pOH4KQZAi38di7BTA9SDUmFZxL0EEYnHk6z588qKEGAFxkjyQI5lSIKW+Oo0tD xs8O3u+60EjVYKbJm2riLRkkzkmkClqKLRGLkh/jW9eYz6FtzouaMsEJjPD/uRkdX2VB PXvY0kgLxY1KtCnCl9/sIlChEFHkDbnZonxxNRC4Kxtas51KMF4/LG22oac1TDQO/IlD mhbQ==; 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=1781827713; x=1782432513; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=KuUIvHQjcQDZNnzN1mUyY6SFj6mz0/b2AOdhCSQpHl0=; b=ZAXL+IsD7OlIdzY4Fi9c+JMxdYfkaPF4y7u9n1rDv2jx0VhzSf/61wmKvbIdHAZrhB tBu+0yhvcYFdDBavs1XCoCz/z2cmXtKM+D2XdF08YFPqlgjAo2ZH52ltrJXruasgYJLu nzq5TttcWLYEO5S7wb2ZmQ/D+veS4FUEzOx9XE8BGEcySTDKlarAImu0L+NBxrkflp/I dkfPPYFFl4P5wVuNNb9BDlzTc4qwkTmXQxLr/YK8KTlYsE205ZjtDj4lLc1Gn3q4lAKd VooX4XunkmRFoif675MjmnEDrg8a09X74CVFeTjsEgrgejnfW5Z8yRYPc907tkmAxo9F O4Vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781827713; x=1782432513; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=KuUIvHQjcQDZNnzN1mUyY6SFj6mz0/b2AOdhCSQpHl0=; b=hGhEJPTv/Ha62Tr7qbavnHAhadbjQMH+TNCy7NcoDEfWv4b/Fb6/shrsJMsR4wzhVJ RMdGDuuJsju9GZwrf12/xNnSScgbw4l0flYY1bnb0/eKDcZBUm6TuWmKbKFzj2Rpc0ez 3O/ckrwg4waYas2y6ZHRPk+Z+6KOAvK74j/VlMfU6pOi8Kixn+gHkiERHWyzXjfm1sJw Bl3naV9QcbdTxA/GuJOAdOGp3JUGQtNWRaT41Ou3/QY9RTjM4SEkoVh8ZKkb+BjEX11D 5fepfag2DOLtE959JGIRKg7SVybUaVpVepmp12KMSaty1H4UwpUlG86iXZEhNqPcEGg3 jO1g== X-Forwarded-Encrypted: i=1; AFNElJ/OCAzZzf2mS0lD93TJiHZg/e+KaTF8Ogx/5GaVp1/tcbPljzM1dqwOXj/PtITAKIh4FM0xNnqgccWFw4Pc@postgresql.org X-Gm-Message-State: AOJu0Yy1SeHyxPjoM9q/AndqXg2gOKR5JWZ4gC4zzCDsbmOqXYJfWUzI iRnLLKSSTlHhKuoOPeFUuR/8oI6zrzWYo8e8t0xPHEXnvM3Lq7iB8NfW9kETSCtR1SSEfK5l3sm XAWgw65ElWz9h39UoosB0FcDUUvpPwsU= X-Gm-Gg: AfdE7cl6diVG/zh8LZXiOsxjrCW3GEH1Ez7nnrt3KS6/HkBbAMHv1cg1bqXMqCvzbje so35RFEAqkEzvYVGJcAruf/JREz5bYYNhSFJSY5jd2nUABw8CL7EMrDZSm+Rms+hA3hSgieQuLt SFyMu3P4YZIAu/ngox+290dJxKQopIUHCL9vIQcNjsa6u7fM111ESpl5r9wnYv2JaTOnTKqCHda YFPM2F2Z//SNRUKjo+fTs+VaVaecFi8WBJoDZPyeoyNViO3y2qZLhH/0rtkgB7p3SBonpDMUYyC quEpNKj2dQvVakzAeO1xp5mR6bvB0qbrYduWhAbs6ALO1GjCGHuuPlQf71lELjCDDJlU5bYAdj5 w2jTY7pr0+v7XBZsjQbBwIVLXf6ZIqk55LFD7YVhxh6mHB4ghWBbBmy70fgpO/zl+/CKgAIvc32 iuETagqfNulYYwJrY= X-Received: by 2002:a05:6102:2922:b0:631:ea6b:23dc with SMTP id ada2fe7eead31-72a0168c4a2mr1611216137.2.1781827711815; Thu, 18 Jun 2026 17:08:31 -0700 (PDT) MIME-Version: 1.0 References: <20260618.185007.1430819167281911424.ishii@postgresql.org> In-Reply-To: <20260618.185007.1430819167281911424.ishii@postgresql.org> From: jian he Date: Fri, 19 Jun 2026 08:07:53 +0800 X-Gm-Features: AVVi8Cc2r0beJI7_zSHj7z0shigeb7pcqI71JQfU8hw5Hu6zKDMzev2NNyFd26c Message-ID: Subject: Re: Row pattern recognition To: Tatsuo Ishii Cc: assam258@gmail.com, 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: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Jun 18, 2026 at 5:50=E2=80=AFPM Tatsuo Ishii = wrote: > > Hi Henson, > > > 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. > > > 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 a= nd > > 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 st= ill > > 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 behavi= ng > > the same inside and outside a DEFINE clause. (c) is what's in the t= ree > > 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? > ParseFuncOrColumn cleanly handles (f).prev by translating it to prev(f) as = a regular function call. However, if a dedicated window navigation function exists, this translation creates ambiguity =E2=80=94 it becomes unclear whe= ther prev(f) is window navigation or a normal function call. Cases with additional dots (e.g., public.prev(arg)) should also be treated as normal function calls, IMHO. As a result, only prev(arg) and prev(arg, offset) are recognized as special window navigation syntax, despite being visually identical to a function ca= ll. Summary: Dedicated window navigation functions should be removed entirely. Window navigation should be limited to a single syntactic form (no dots) =E2=80=94= one that *looks* like a function call but is parsed as syntax. This is not unprecedented; there are many existing cases where something ap= pears to be a function call but is actually a syntax form, for example: SELECT json_object('{}'); json_object ------------- {} (1 row) SELECT public.json_object('{}'); ERROR: function public.json_object(unknown) does not exist LINE 1: SELECT public.json_object('{}'); ^ So I think in the DEFINE context, it makes sense for some form that looks like a function call to actually be syntax.