Re: pgbench: using prepared BEGIN statement in a pipeline could cause an error

2023-05-25 Thread Alvaro Herrera
On 2023-May-22, Alvaro Herrera wrote: > Hah, yeah, that's because an empty pipeline never calls the code to > allocate the flag array. Here's the trivial fix. Pushed to both branches, thanks for the report. -- Álvaro HerreraBreisgau, Deutschland — https://www.EnterpriseDB.com/

Re: pgbench: using prepared BEGIN statement in a pipeline could cause an error

2023-05-22 Thread Alvaro Herrera
On 2023-May-20, Alexander Lakhin wrote: > Starting from 038f586d5, the following script: > echo " > \startpipeline > \endpipeline > " >test.sql > pgbench -n -M prepared -f test.sql > > leads to the pgbench's segfault: Hah, yeah, that's because an empty pipeline never calls the code to allocate

Re: pgbench: using prepared BEGIN statement in a pipeline could cause an error

2023-05-20 Thread Alexander Lakhin
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

Re: pgbench: using prepared BEGIN statement in a pipeline could cause an error

2023-02-21 Thread Alvaro Herrera
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

Re: pgbench: using prepared BEGIN statement in a pipeline could cause an error

2023-02-20 Thread Alvaro Herrera
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

Re: pgbench: using prepared BEGIN statement in a pipeline could cause an error

2023-02-17 Thread Alvaro Herrera
On 2023-Feb-13, Andres Freund wrote: > There's something wrong with the patch, it reliably fails with core dumps: > https://cirrus-ci.com/github/postgresql-cfbot/postgresql/commitfest%2F42%2F3260 I think this would happen on machines where sizeof(bool) is not 1 (which mine is evidently not).

Re: pgbench: using prepared BEGIN statement in a pipeline could cause an error

2023-02-13 Thread Andres Freund
Hi, On 2023-02-08 13:10:40 +0100, Alvaro Herrera wrote: > On 2023-Feb-08, Alvaro Herrera wrote: > > > I propose instead the following: each command is prepared just before > > it's executed, as previously, and if we see a \startpipeline, then we > > prepare all commands starting with the one

Re: pgbench: using prepared BEGIN statement in a pipeline could cause an error

2023-02-08 Thread Alvaro Herrera
On 2023-Feb-08, Alvaro Herrera wrote: > I propose instead the following: each command is prepared just before > it's executed, as previously, and if we see a \startpipeline, then we > prepare all commands starting with the one just after, and until the > \endpipeline. Here's the patch. --

Re: pgbench: using prepared BEGIN statement in a pipeline could cause an error

2023-02-08 Thread Alvaro Herrera
On 2022-Sep-30, Yugo NAGATA wrote: > Well, I still don't understand why we need to prepare only "the > commands within a pipeline" before starting pipeline. In the current > behavior, the entire script is prepared in advance just before executing > the first SQL command in the script, instead

Re: pgbench: using prepared BEGIN statement in a pipeline could cause an error

2023-02-06 Thread Tom Lane
Alvaro Herrera writes: > I'm writing my own patch for this problem. While playing around with > it, I noticed this: > struct Command { > /* size: 2168, cachelines: 34, members: 11 */ > /* sum members: 2164, holes: 1, sum holes: 4 */ > /* last cacheline: 56 bytes */ > }; I think the

Re: pgbench: using prepared BEGIN statement in a pipeline could cause an error

2023-02-06 Thread Alvaro Herrera
I'm writing my own patch for this problem. While playing around with it, I noticed this: struct Command { PQExpBufferDatalines;/* 024 */ char * first_line; /*24 8 */ inttype;

Re: pgbench: using prepared BEGIN statement in a pipeline could cause an error

2022-09-29 Thread Yugo NAGATA
Hi, On Mon, 12 Sep 2022 17:03:43 +0200 Alvaro Herrera wrote: > On 2022-Mar-28, Yugo NAGATA wrote: > > > On Fri, 25 Mar 2022 16:19:54 -0400 > > Tom Lane wrote: > > > > I am not convinced this is a great idea. The current behavior is that > > > a statement is not prepared until it's about to

Re: pgbench: using prepared BEGIN statement in a pipeline could cause an error

2022-09-12 Thread Alvaro Herrera
On 2022-Mar-28, Yugo NAGATA wrote: > On Fri, 25 Mar 2022 16:19:54 -0400 > Tom Lane wrote: > > I am not convinced this is a great idea. The current behavior is that > > a statement is not prepared until it's about to be executed, and I think > > we chose that deliberately to avoid semantic

Re: pgbench: using prepared BEGIN statement in a pipeline could cause an error

2022-09-04 Thread Ibrar Ahmed
On Sat, Sep 3, 2022 at 12:09 PM Julien Rouhaud wrote: > Hi, > > On Sat, Sep 03, 2022 at 10:36:37AM +0500, Ibrar Ahmed wrote: > > > > Hi Kyotaro Horiguchi, Fabien Coelho, Daniel Gustafsson, > > > > Since you haven't had time to write a review the last many days, the > author > > replied > > with

Re: pgbench: using prepared BEGIN statement in a pipeline could cause an error

2022-09-03 Thread Julien Rouhaud
Hi, On Sat, Sep 03, 2022 at 10:36:37AM +0500, Ibrar Ahmed wrote: > > Hi Kyotaro Horiguchi, Fabien Coelho, Daniel Gustafsson, > > Since you haven't had time to write a review the last many days, the author > replied > with a rebased patch for a long time and never heard. We've taken your name >

Re: pgbench: using prepared BEGIN statement in a pipeline could cause an error

2022-09-02 Thread Ibrar Ahmed
On Mon, Mar 28, 2022 at 8:35 AM Yugo NAGATA wrote: > On Fri, 25 Mar 2022 16:19:54 -0400 > Tom Lane wrote: > > > Fabien COELHO writes: > > >> [...] One way to avoid these errors is to send Parse messages before > > >> pipeline mode starts. I attached a patch to fix to prepare commands > at > >

Re: pgbench: using prepared BEGIN statement in a pipeline could cause an error

2022-03-27 Thread Yugo NAGATA
On Fri, 25 Mar 2022 16:19:54 -0400 Tom Lane wrote: > Fabien COELHO writes: > >> [...] One way to avoid these errors is to send Parse messages before > >> pipeline mode starts. I attached a patch to fix to prepare commands at > >> starting of a script instead of at the first execution of the

Re: pgbench: using prepared BEGIN statement in a pipeline could cause an error

2022-03-25 Thread Tom Lane
Fabien COELHO writes: >> [...] One way to avoid these errors is to send Parse messages before >> pipeline mode starts. I attached a patch to fix to prepare commands at >> starting of a script instead of at the first execution of the command. > ISTM that moving prepare out of command execution

Re: pgbench: using prepared BEGIN statement in a pipeline could cause an error

2022-02-28 Thread Yugo NAGATA
Hi Horiguchi-san, On Thu, 27 Jan 2022 17:50:25 +0900 (JST) Kyotaro Horiguchi wrote: > At Tue, 16 Nov 2021 02:26:43 +0900, Yugo NAGATA wrote > in > > Thank you for pointing it out! > > I attached the updated patch. > > I think we want more elabolative comment for the new place of > preparing

Re: pgbench: using prepared BEGIN statement in a pipeline could cause an error

2022-01-27 Thread Kyotaro Horiguchi
At Tue, 16 Nov 2021 02:26:43 +0900, Yugo NAGATA wrote in > Thank you for pointing it out! > I attached the updated patch. I think we want more elabolative comment for the new place of preparing as you mentioned in the first mail. At Fri, 16 Jul 2021 15:30:13 +0900, Yugo NAGATA wrote in > One

Re: pgbench: using prepared BEGIN statement in a pipeline could cause an error

2021-11-15 Thread Yugo NAGATA
Hello Daniel Gustafsson, On Mon, 15 Nov 2021 14:13:32 +0100 Daniel Gustafsson wrote: > > On 21 Jul 2021, at 03:49, Yugo NAGATA wrote: > > > I attached the updated patch v2, which includes a comment fix and a TAP > > test. > > This patch fails the TAP test for pgbench: Thank you for

Re: pgbench: using prepared BEGIN statement in a pipeline could cause an error

2021-11-15 Thread Daniel Gustafsson
> On 21 Jul 2021, at 03:49, Yugo NAGATA wrote: > I attached the updated patch v2, which includes a comment fix and a TAP test. This patch fails the TAP test for pgbench: # Tests were run but no plan was declared and done_testing() was not seen. # Looks like your test exited with 25 just

Re: pgbench: using prepared BEGIN statement in a pipeline could cause an error

2021-07-20 Thread Yugo NAGATA
On Mon, 19 Jul 2021 10:51:36 +0900 Yugo NAGATA wrote: > Hello Fabien, > > On Sat, 17 Jul 2021 07:03:01 +0200 (CEST) > Fabien COELHO wrote: > > > > > Hello Yugo-san, > > > > > [...] One way to avoid these errors is to send Parse messages before > > > pipeline mode starts. I attached a patch

Re: pgbench: using prepared BEGIN statement in a pipeline could cause an error

2021-07-18 Thread Yugo NAGATA
Hello Fabien, On Sat, 17 Jul 2021 07:03:01 +0200 (CEST) Fabien COELHO wrote: > > Hello Yugo-san, > > > [...] One way to avoid these errors is to send Parse messages before > > pipeline mode starts. I attached a patch to fix to prepare commands at > > starting of a script instead of at the

Re: pgbench: using prepared BEGIN statement in a pipeline could cause an error

2021-07-16 Thread Fabien COELHO
Hello Yugo-san, [...] One way to avoid these errors is to send Parse messages before pipeline mode starts. I attached a patch to fix to prepare commands at starting of a script instead of at the first execution of the command. What do you think? ISTM that moving prepare out of command

pgbench: using prepared BEGIN statement in a pipeline could cause an error

2021-07-16 Thread Yugo NAGATA
Hello, I found that using "BEGIN ISOLATINO LEVEL SERIALIZABLE" in a pipline with prepared statement makes pgbench abort. $ cat pipeline.sql \startpipeline begin isolation level repeatable read; select 1; end; \endpipeline $ pgbench -f pipeline.sql -M prepared -t 1 pgbench (15devel)