From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Andres Freund <andres@anarazel.de>
Cc: pgsql-hackers@lists.postgresql.org, Robert Haas <robertmhaas@gmail.com>
Subject: Re: CLOBBER_CACHE_ALWAYS regression instability
Date: Sun, 5 Apr 2020 19:54:19 -0400
Message-ID: <20200405235419.GA24134@alvherre.pgsql> (raw)
In-Reply-To: <2887.1586116355@sss.pgh.pa.us>
On 2020-Apr-05, Tom Lane wrote:
> What I wish we had was alloca(), so you don't need a FUNC_MAX_ARGS-sized
> array to parse a two-argument function call. Too bad C99 didn't add
> that. (But some sniffing around suggests that an awful lot of systems
> have it anyway ... even MSVC. Hmmm.)
Isn't it the case that you can create an inner block with a constant
whose size is determined by a containing block's variable? I mean as in
the attached, which refuses to compile because of our -Werror=vla -- but
if I remove it, it compiles fine and works in my system.
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Attachments:not-alloca.patch (text/x-diff, 976B) downloaddiff --git a/src/backend/parser/parse_func.c b/src/backend/parser/parse_func.cindex 9c3b6ad916..415ea17c68 100644--- a/src/backend/parser/parse_func.c+++ b/src/backend/parser/parse_func.c@@ -103,7 +103,6 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
Node *first_arg = NULL;
int nargs;
int nargsplusdefs;
- Oid actual_arg_types[FUNC_MAX_ARGS];
Oid *declared_arg_types;
List *argnames;
List *argdefaults;
@@ -115,6 +114,9 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
char aggkind = 0;
ParseCallbackState pcbstate;
+ {+ Oid actual_arg_types[list_length(fargs)];+
/*
* If there's an aggregate filter, transform it using transformWhereClause
*/
@@ -888,6 +890,7 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
/* if it returns a set, remember it for error checks at higher levels */
if (retset)
pstate->p_last_srf = retval;
+ }
return retval;
}
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: alvherre@2ndquadrant.com, tgl@sss.pgh.pa.us, andres@anarazel.de, robertmhaas@gmail.com
Subject: Re: CLOBBER_CACHE_ALWAYS regression instability
In-Reply-To: <20200405235419.GA24134@alvherre.pgsql>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox