Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q0P0A-0006b8-Nt for pgsql-hackers@arkaria.postgresql.org; Sat, 20 May 2023 16:00:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1q0P08-0004RG-Or for pgsql-hackers@arkaria.postgresql.org; Sat, 20 May 2023 16:00:12 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q0P08-0004R6-En for pgsql-hackers@lists.postgresql.org; Sat, 20 May 2023 16:00:12 +0000 Received: from mail-lj1-x233.google.com ([2a00:1450:4864:20::233]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1q0P01-000sCA-PR for pgsql-hackers@postgresql.org; Sat, 20 May 2023 16:00:11 +0000 Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2af28303127so17096661fa.3 for ; Sat, 20 May 2023 09:00:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684598404; x=1687190404; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=D2M1O/6rqJL4FbjVV80jadsUtm7YQJO5RX3IhZwdIdY=; b=C0of32CQb2/x0HknmKAZVKq4N0Yn552Qxv9kr/Qf1mmfBZj8oVPJUz077Hp/YGNBvv 1c53BA4dLgfsdmYBfErBnTr7vsPz0ykYijAxaDZQCGj51GA7/VPClBcGbMREnxYsDBbh UbqHE3CwWXr512w+m6vmut3pxh8VzmFGkh1Y+/r0Bkmg5Hl2+Y7dJlF/W+iIo20WxVoQ QhuaRYxmCENineWBnLeBEuMOe9feIRfHds8exK4kak9qsf0QE2L7dO2JaUgpY8xXsIwD 4c0gkqktxCFU9qtPx13EkkB5J7dTFpkEXqx4TPQGgEm32Pw0G5sDjrcTLSBJaDmTWEJL nlRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684598404; x=1687190404; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=D2M1O/6rqJL4FbjVV80jadsUtm7YQJO5RX3IhZwdIdY=; b=W+4/RJS11sA4c+SXI1LjIu6J/bTr+7UoRDHirPR7eAL3VuwnSSnnNECTvHKzbvdsnK FPlmSnSUj/sMgSq2OXpW+LhFKvFCuVeXQua45pxtPORnCEBC9tP4VR0T05eSoC4ivaUJ MtJIpsmpjG2G9y6oKMBHFYrKWwCjmLYvp9jimEbULEGlo9gW5zkawnW3cMPL3N2S1i2r GKkZ4mq8ies4Qo0TuD8XI3ILb++EusbqYDRLBtBqb6RNM7MNQLqyX6ki9hf5Ecs2DCs0 GypC3vuh+hB03lpYvZL66KGEYoToeuCyPlkHhh4SPcOfn3xkGWi1nHCLvN8i+6lcoQKk 02zw== X-Gm-Message-State: AC+VfDyvDu0J4+9cLqm6bTKJIIO7NwoihIbMSwLy13PzM+4IZLe7bsCR k41SAbtswHy2XlZT8PnDURg= X-Google-Smtp-Source: ACHHUZ7coBa58yH23Z6hswCe5OQfG+6SZP0JO8esocPyzwFn6QQUP39wsByHSV7Ar5jc6eY+Btrrow== X-Received: by 2002:a05:651c:103b:b0:2ac:66c8:3c4b with SMTP id w27-20020a05651c103b00b002ac66c83c4bmr2010533ljm.11.1684598403793; Sat, 20 May 2023 09:00:03 -0700 (PDT) Received: from [1.0.0.7] ([81.23.166.126]) by smtp.gmail.com with ESMTPSA id r12-20020a2eb60c000000b002ab017899e8sm342849ljn.39.2023.05.20.09.00.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 20 May 2023 09:00:02 -0700 (PDT) Message-ID: Date: Sat, 20 May 2023 19:00:01 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: pgbench: using prepared BEGIN statement in a pipeline could cause an error Content-Language: en-US To: Alvaro Herrera Cc: Yugo NAGATA , Andres Freund , Tom Lane , Fabien COELHO , pgsql-hackers@postgresql.org References: <20230221163249.orhvsut5re55fcn3@alvherre.pgsql> From: Alexander Lakhin In-Reply-To: <20230221163249.orhvsut5re55fcn3@alvherre.pgsql> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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=, argv=) at pgbench.c:7253 Best regards, Alexander