Hello Alvaro,
21.02.2023 19:32, Alvaro Herrera wrote:
On 2023-Feb-20, Alvaro Herrera wrote:
Found one last problem: if you do "-f foobar.sql -M prepared" in that
order, then the prepare fails because the statement names would not be
assigned when the file is parsed. This coding only supported doing
"-M prepared -f foobar.sql", which funnily enough is the only one that
PostgreSQL/Cluster.pm->pgbench() supports. So I moved the prepared
statement name generation to the postprocess step.
Pushed to all three branches -- thanks, Nagata-san, for diagnosing the
issue.
Starting from 038f586d5, the following script:
echo "
\startpipeline
\endpipeline
" >test.sql
pgbench -n -M prepared -f test.sql
leads to the pgbench's segfault:
Core was generated by `pgbench -n -M prepared -f test.sql'.
Program terminated with signal SIGSEGV, Segmentation fault.
warning: Section `.reg-xstate/2327306' in core file too small.
#0 0x0000555a402546b4 in prepareCommandsInPipeline
(st=st@entry=0x555a409d62e0) at pgbench.c:3130
3130 st->prepared[st->use_file][st->command] = true;
(gdb) bt
#0 0x0000555a402546b4 in prepareCommandsInPipeline
(st=st@entry=0x555a409d62e0) at pgbench.c:3130
#1 0x0000555a40257fca in executeMetaCommand (st=st@entry=0x555a409d62e0,
now=now@entry=0x7ffdd46eff58)
at pgbench.c:4413
#2 0x0000555a402585ce in advanceConnectionState
(thread=thread@entry=0x555a409d6580, st=st@entry=0x555a409d62e0,
agg=agg@entry=0x7ffdd46f0090) at pgbench.c:3807
#3 0x0000555a40259564 in threadRun (arg=arg@entry=0x555a409d6580) at
pgbench.c:7535
#4 0x0000555a4025ca40 in main (argc=<optimized out>, argv=<optimized out>) at
pgbench.c:7253
Best regards,
Alexander