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 1we8R9-004aRU-00 for pgsql-hackers@arkaria.postgresql.org; Mon, 29 Jun 2026 09:37:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1we8R7-002PFU-29 for pgsql-hackers@arkaria.postgresql.org; Mon, 29 Jun 2026 09:37:53 +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 1we8R7-002PFI-14 for pgsql-hackers@lists.postgresql.org; Mon, 29 Jun 2026 09:37:53 +0000 Received: from meldrar.postgresql.org ([2a02:c0:301:0:ffff::31]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1we8R4-00000000jls-1yCI for pgsql-hackers@postgresql.org; Mon, 29 Jun 2026 09:37:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=postgresql.org; s=20171124; h=Content-Transfer-Encoding:Content-Type: Mime-Version:References:In-Reply-To:From:Subject:Cc:To:Message-Id:Date:Sender :Reply-To:Content-ID:Content-Description; bh=4c/MsSpVMdCTpzeXWNFM0zWf0QP+u52Scq0ZHx8cR0M=; b=aAUMLD9pRrX8j8nzfyzfVV3HLW hvz4vg6ZH4ceT4HdJWS9pk2PzdBBVSMWqph5FHZLGXTZmo0HHwLy+qwt4x19aAs+/sBSPhZE37F77 /cFxSuDNXPRdT2Ay25eeqQn+p1X7og+pGNu5gU0dM4dgtcHuvdejNPPCRsYHEGc7k6XeizJPdlk+Q 4E7lxcJ/rb84265PTDohradIQixBf5IB9mIKEyBmNKRZV/gsfYqu//PRRzMhCRE22KklAk30ufrG8 YRzsfhnO8D+AJUdQSldTwI1huRQN0mYNhVz714B3I/hAlCymhS+Jzh3y89CcJ5jU1PGqRWpET6ySd 7LY93pRA==; Received: from [2409:11:4120:300:c071:ecd9:16f6:455c] (helo=localhost) by meldrar.postgresql.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1we8R0-007b32-1s; Mon, 29 Jun 2026 09:37:49 +0000 Date: Mon, 29 Jun 2026 18:37:30 +0900 (JST) Message-Id: <20260629.183730.1799088184925453299.ishii@postgresql.org> To: assam258@gmail.com Cc: jian.universality@gmail.com, pgsql-hackers@postgresql.org, 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 Subject: Re: Row pattern recognition From: Tatsuo Ishii In-Reply-To: References: <20260622.215536.1729984032454200237.ishii@postgresql.org> X-Mailer: Mew version 6.8 on Emacs 29.3 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 2409:11:4120:300:c071:ecd9:16f6:455c (failed) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > Hi hackers, > > This is v50, folding in the outstanding review. From my side there are no > known issues left, so I think it makes a good starting point for the kind of > thorough public review the feature should get before commit. Thanks for the incremental patches. I am going to publish v50 patch series. Here are some commnets to the v50-* patches. > First, two cleanups splitting changes unrelated to RPR out of the feature > patch: > > v50-0001 Remove blank-line changes unrelated to row pattern recognition > v50-0002 Remove unnecessary includes from the row pattern recognition > patch 0001 and 0002 look good to me. > The fixes (v50-0003..0005, all behavior-changing): > > v50-0003 Recognize row pattern navigation operations by name in DEFINE diff --git a/src/backend/parser/parse_func.c b/src/backend/parser/parse_func.c index 1f6c8fa4fb2..f3b37aa992c 100644 --- a/src/backend/parser/parse_func.c +++ b/src/backend/parser/parse_func.c @@ -2111,6 +2080,151 @@ FuncNameAsType(List *funcname) + if (fn->func_variadic) + ereport(ERROR, + (errcode(ERRCODE_SYNTAX_ERROR), + errmsg("cannot use VARIADIC with row pattern navigation function %s", + navname), + parser_errposition(pstate, location))); + if (argnames != NIL) + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("row pattern navigation operations cannot use named arguments"), + parser_errposition(pstate, location))); Shouldn't the error code for the named arguments case be ERRCODE_SYNTAX_ERROR? As far as I know the SQL standard does not allow to use named arguments with row pattern navigation operations. So it's not a required feature. Also errmsg is different from surroundings. Probably "cannot use named arguments with row pattern navigation function %s" is better? diff --git a/src/backend/parser/parse_rpr.c b/src/backend/parser/parse_rpr.c index 3eaea2be750..8ed01bb8f28 100644 --- a/src/backend/parser/parse_rpr.c +++ b/src/backend/parser/parse_rpr.c @@ -472,6 +472,7 @@ transformDefineClause(ParseState *pstate, WindowClause *wc, WindowDef *windef, * * PREV/NEXT wrapping FIRST/LAST flattens to a compound kind * * Other nestings are rejected (FIRST(PREV()), PREV(PREV()), ...) * * offset_arg / compound_offset_arg must not contain column refs + * or nested navigation operations Needs '*' in front of "or nested....". > v50-0004 Use a dedicated ExprContext for RPR DEFINE clause evaluation Looks good to me. Will continue reviewes tomorrow. Regards, -- Tatsuo Ishii SRA OSS K.K. English: http://www.sraoss.co.jp/index_en/ Japanese:http://www.sraoss.co.jp