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 1wKCIu-000i8w-2p for pgsql-hackers@arkaria.postgresql.org; Tue, 05 May 2026 09:43:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wKCIt-00BFkR-0z for pgsql-hackers@arkaria.postgresql.org; Tue, 05 May 2026 09:42:59 +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 1wKCIs-00BFkI-2K for pgsql-hackers@lists.postgresql.org; Tue, 05 May 2026 09:42:59 +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 1wKCIo-00000000Hxc-3nRh for pgsql-hackers@postgresql.org; Tue, 05 May 2026 09:42:57 +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=jtSigjOzKI9pml+9My0GVIbhIiJpuWgfhOLT1Glbvo0=; b=qrbtrGDAfvjwQUqjhv8Pap3nIH vzqDmqvVxZN5uAtCldoDCx10tRxfgSICritLaIGq+k8bpAr7hQOZCb9jJqdhEY/AWIKk4Xn8/qfgt 4I5pMsebeKKzt34hPRML92nUBK+m1Z6aQrRGwNEIIl4RcvOuMeRNxLfIWl7wvPfUX2e30XfTCYO2g fH82rb+8yt2slTG6v78VwukR0Cs9qyEUeyJNG1qI5v4trk8l7AbwPMhEBcf1UUe9aEJUEXA68jzZQ i9SXq6yU/9IBrtE9mrSg5kf02KMVkb+zkxZg5GdDkIjBIPl7/SNNhMC21Nczx8GSWtZrbYGJ8Esxl x/uckShg==; Received: from [2409:11:4120:300:255:fbec:3d88:4ce7] (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 1wKCIf-0022rw-0O; Tue, 05 May 2026 09:42:46 +0000 Date: Tue, 05 May 2026 18:42:28 +0900 (JST) Message-Id: <20260505.184228.594389150715346967.ishii@postgresql.org> To: assam258@gmail.com Cc: jian.universality@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 Subject: Re: Row pattern recognition From: Tatsuo Ishii In-Reply-To: References: <20260505.170845.1271951360939093763.ishii@postgresql.org> X-Mailer: Mew version 6.8 on Emacs 29.3 Mime-Version: 1.0 Content-Type: Multipart/Mixed; boundary="--Next_Part(Tue_May__5_18_42_28_2026_768)--" Content-Transfer-Encoding: 7bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 2409:11:4120:300:255:fbec:3d88:4ce7 (failed) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ----Next_Part(Tue_May__5_18_42_28_2026_768)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi Henson, > The outer-parentheses pattern appears in 17 ereport() calls in > parse_rpr.c and 2 in optimizer/plan/rpr.c. All 19 sites will be > cleaned up in the next series. I see them in gram.y as well. See attached patch. > Jian, I will review your other patches as well. > > Best, > Henson ----Next_Part(Tue_May__5_18_42_28_2026_768)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="ereport_fix.txt" diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y index f3cedfbbb18..aa587e6aced 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -17610,10 +17610,10 @@ opt_row_pattern_initial_or_seek: | SEEK { ereport(ERROR, - (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("SEEK is not supported"), - errhint("Use INITIAL instead."), - parser_errposition(@1))); + errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("SEEK is not supported"), + errhint("Use INITIAL instead."), + parser_errposition(@1)); } | /*EMPTY*/ { $$ = true; } ; @@ -17740,40 +17740,40 @@ row_pattern_quantifier_opt: $$ = (Node *) makeRPRQuantifier(0, 1, @1 + 1, @1, yyscanner); else ereport(ERROR, - (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("unsupported quantifier \"%s\"", $1), - errhint("Valid quantifiers are: *, +, ?, *?, +?, ??, {n}, {n,}, {,m}, {n,m} and their reluctant versions."), - parser_errposition(@1))); + errcode(ERRCODE_SYNTAX_ERROR), + errmsg("unsupported quantifier \"%s\"", $1), + errhint("Valid quantifiers are: *, +, ?, *?, +?, ??, {n}, {n,}, {,m}, {n,m} and their reluctant versions."), + parser_errposition(@1)); } /* RELUCTANT quantifiers (when lexer separates tokens) */ | '*' Op { if (strcmp($2, "?") != 0) ereport(ERROR, - (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("invalid token after \"*\" quantifier"), - errhint("Did you mean \"*?\" for reluctant quantifier?"), - parser_errposition(@2))); + errcode(ERRCODE_SYNTAX_ERROR), + errmsg("invalid token after \"*\" quantifier"), + errhint("Did you mean \"*?\" for reluctant quantifier?"), + parser_errposition(@2)); $$ = (Node *) makeRPRQuantifier(0, INT_MAX, @2, @1, yyscanner); } | '+' Op { if (strcmp($2, "?") != 0) ereport(ERROR, - (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("invalid token after \"+\" quantifier"), - errhint("Did you mean \"+?\" for reluctant quantifier?"), - parser_errposition(@2))); + errcode(ERRCODE_SYNTAX_ERROR), + errmsg("invalid token after \"+\" quantifier"), + errhint("Did you mean \"+?\" for reluctant quantifier?"), + parser_errposition(@2)); $$ = (Node *) makeRPRQuantifier(1, INT_MAX, @2, @1, yyscanner); } | Op Op { if (strcmp($1, "?") != 0 || strcmp($2, "?") != 0) ereport(ERROR, - (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("invalid quantifier combination"), - errhint("Did you mean \"??\" for reluctant quantifier?"), - parser_errposition(@1))); + errcode(ERRCODE_SYNTAX_ERROR), + errmsg("invalid quantifier combination"), + errhint("Did you mean \"??\" for reluctant quantifier?"), + parser_errposition(@1)); $$ = (Node *) makeRPRQuantifier(0, 1, @2, @1, yyscanner); } /* {n}, {n,}, {,m}, {n,m} quantifiers */ @@ -17823,10 +17823,10 @@ row_pattern_quantifier_opt: { if (strcmp($4, "?") != 0) ereport(ERROR, - (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("invalid token after range quantifier"), - errhint("Only \"?\" is allowed after {n} to make it reluctant."), - parser_errposition(@4))); + errcode(ERRCODE_SYNTAX_ERROR), + errmsg("invalid token after range quantifier"), + errhint("Only \"?\" is allowed after {n} to make it reluctant."), + parser_errposition(@4)); if ($2 <= 0 || $2 >= INT_MAX) ereport(ERROR, errcode(ERRCODE_SYNTAX_ERROR), @@ -17838,10 +17838,10 @@ row_pattern_quantifier_opt: { if (strcmp($5, "?") != 0) ereport(ERROR, - (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("invalid token after range quantifier"), - errhint("Only \"?\" is allowed after {n,} or {,m} to make it reluctant."), - parser_errposition(@5))); + errcode(ERRCODE_SYNTAX_ERROR), + errmsg("invalid token after range quantifier"), + errhint("Only \"?\" is allowed after {n,} or {,m} to make it reluctant."), + parser_errposition(@5)); if ($2 < 0 || $2 >= INT_MAX) ereport(ERROR, errcode(ERRCODE_SYNTAX_ERROR), @@ -17853,10 +17853,10 @@ row_pattern_quantifier_opt: { if (strcmp($5, "?") != 0) ereport(ERROR, - (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("invalid token after range quantifier"), - errhint("Only \"?\" is allowed after {n,} or {,m} to make it reluctant."), - parser_errposition(@5))); + errcode(ERRCODE_SYNTAX_ERROR), + errmsg("invalid token after range quantifier"), + errhint("Only \"?\" is allowed after {n,} or {,m} to make it reluctant."), + parser_errposition(@5)); if ($3 <= 0 || $3 >= INT_MAX) ereport(ERROR, errcode(ERRCODE_SYNTAX_ERROR), @@ -17868,10 +17868,10 @@ row_pattern_quantifier_opt: { if (strcmp($6, "?") != 0) ereport(ERROR, - (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("invalid token after range quantifier"), - errhint("Only \"?\" is allowed after {n,m} to make it reluctant."), - parser_errposition(@6))); + errcode(ERRCODE_SYNTAX_ERROR), + errmsg("invalid token after range quantifier"), + errhint("Only \"?\" is allowed after {n,m} to make it reluctant."), + parser_errposition(@6)); if ($2 < 0 || $4 <= 0 || $2 >= INT_MAX || $4 >= INT_MAX) ereport(ERROR, errcode(ERRCODE_SYNTAX_ERROR), ----Next_Part(Tue_May__5_18_42_28_2026_768)----