Re: pgbench - allow to create partitioned tables - Mailing list pgsql-hackers

From Fabien COELHO
Subject Re: pgbench - allow to create partitioned tables
Date
Msg-id alpine.DEB.2.21.1910031016330.5342@lancre
Whole thread Raw
In response to Re: pgbench - allow to create partitioned tables  (Ashutosh Sharma <ashu.coek88@gmail.com>)
Responses Re: pgbench - allow to create partitioned tables
List pgsql-hackers
Hello,

> As partitions is an integer type variable, the maximum value it can
> hold is "2147483647". But if I specify partitions as "3147483647",
> atoi function returns a value lesser than zero and pgbench terminates
> with an error. However, if the value for number of partitions
> specified is something like "5147483647", atoi returns a non-negative
> number and pgbench creates as many number of partitions as the value
> returned by atoi function.
>
> This seems like a problem with atoi function, isn't it?

Yes.

> atoi functions has been used at several places in pgbench script and I
> can see similar behaviour for all. For e.g. it has been used with
> scale factor and above observation is true for that as well. So, is
> this a bug or you guys feel that it isn't and can be ignored? Please
> let me know your thoughts on this. Thank you.

I think that it is a known bug (as you noted atoi is used more or less 
everywhere in pgbench and other commands) which shoud be addressed 
separately: all integer user inputs should be validated for syntax and 
overflow, everywhere, really. This is not currently the case, so I simply 
replicated the current bad practice when developing this feature.

There is/was a current patch/discussion to improve integer parsing, which 
could address this.

-- 
Fabien.



pgsql-hackers by date:

Previous
From: Ashutosh Sharma
Date:
Subject: Re: pgbench - allow to create partitioned tables
Next
From: Fujii Masao
Date:
Subject: Re: PATCH: standby crashed when replay block which truncated instandby but failed to truncate in master node