Hi,
While testing
patch (0001-pgbench-Allow-variables-to-be-used-as-an-SQL-literal.patch), I
reproduced the CI failure reported by Michael (-Werror=switch for
PQUOTE_SHELL_ARG in replaceVariable()).
Attached is a small follow-up patch that handles
-The missing enum case,
-Removes an unused variable
-Ensures quoted_value is always initialized.
This builds cleanly for me.
Regards,
Lakshmi
On Fri, Jan 9, 2026 at 2:41 PM Michael Paquier <[email protected]> wrote:
> On Thu, Sep 18, 2025 at 03:33:30PM +0900, Yugo Nagata wrote:
> > Any thought?
>
> Note that the CI is complaining a bit. Relevant extract:
> [22:51:36.908] pgbench.c: In function ‘replaceVariable’:
> [22:51:36.908] pgbench.c:1990:9: error: enumeration value
> ‘PQUOTE_SHELL_ARG’ not handled in switch [-Werror=switch]
> [22:51:36.908] 1990 | switch (quote)
> --
> Michael
>
diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c
index a10e852f77d..102e64902f9 100644
--- a/src/bin/pgbench/pgbench.c
+++ b/src/bin/pgbench/pgbench.c
@@ -1953,14 +1953,17 @@ static char *
replaceVariable(char **sql, char *param, int len, char *value, PsqlScanQuoteType quote, PGconn *conn)
{
int valueln;
- char quotechar;
- char *quoted_value;
+ char *quoted_value = NULL;
switch (quote)
{
case PQUOTE_PLAIN:
quoted_value = pg_strdup(value);
break;
+ case PQUOTE_SHELL_ARG:
+ quoted_value = pg_strdup(value);
+ break;
+
case PQUOTE_SQL_LITERAL:
case PQUOTE_SQL_IDENT:
{
@@ -1995,7 +1998,11 @@ replaceVariable(char **sql, char *param, int len, char *value, PsqlScanQuoteType
break;
}
}
-
+ if (quoted_value == NULL)
+ {
+ pg_log_error("unhandled quoting case");
+ exit(1);
+ }
valueln = strlen(quoted_value);
if (valueln > len)