pgsql: Improve scripting language in pgbench

Started by Teodor Sigaevover 8 years ago5 messageshackerscomitters
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

never appliedCI history
Jump to latest
#1Teodor Sigaev
teodor@sigaev.ru
hackerscomitters

Improve scripting language in pgbench

Added:
- variable now might contain integer, double, boolean and null values
- functions ln, exp
- logical AND/OR/NOT
- bitwise AND/OR/NOT/XOR
- bit right/left shift
- comparison operators
- IS [NOT] (NULL|TRUE|FALSE)
- conditional choice (in form of when/case/then)

New operations and functions allow to implement more complicated test scenario.

Author: Fabien Coelho with minor editorization by me
Reviewed-By: Pavel Stehule, Jeevan Ladhe, me
Discussion: /messages/by-id/alpine.DEB.2.10.1604030742390.31618@sto

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/bc7fa0c15c590ddf4872e426abd76c2634f22aca

Modified Files
--------------
doc/src/sgml/ref/pgbench.sgml | 223 +++++++++++-
src/bin/pgbench/exprparse.y | 195 ++++++++++-
src/bin/pgbench/exprscan.l | 55 ++-
src/bin/pgbench/pgbench.c | 484 +++++++++++++++++++++++----
src/bin/pgbench/pgbench.h | 24 +-
src/bin/pgbench/t/001_pgbench_with_server.pl | 171 ++++++++--
6 files changed, 1026 insertions(+), 126 deletions(-)

#2Thomas Munro
thomas.munro@gmail.com
In reply to: Teodor Sigaev (#1)
hackerscomitters
Re: pgsql: Improve scripting language in pgbench

On Wed, Jan 10, 2018 at 4:02 AM, Teodor Sigaev <teodor@sigaev.ru> wrote:

Improve scripting language in pgbench

Hi Teodor,

I think this commit might have lost a fix from
0aa1d489ea756b96b6d5573692ae9cd5d143c2a5. bowerbird and jacana now
fail when they see an unexpected "0" before the exponent:

Jan 09 11:49:51 # debug(script=0,command=29): double 1e+030
...
Jan 09 11:49:51 # doesn't match '(?-xism:command=29.: double 1e\+30\b)'

I think you need to put "0?" back into the pattern like in the attached.

--
Thomas Munro
http://www.enterprisedb.com

Attachments:

fix.patchapplication/octet-stream; name=fix.patchDownload+1-1
#3Teodor Sigaev
teodor@sigaev.ru
In reply to: Thomas Munro (#2)
hackerscomitters
Re: pgsql: Improve scripting language in pgbench

Thank you very much, applied

Thomas Munro wrote:

On Wed, Jan 10, 2018 at 4:02 AM, Teodor Sigaev <teodor@sigaev.ru> wrote:

Improve scripting language in pgbench

Hi Teodor,

I think this commit might have lost a fix from
0aa1d489ea756b96b6d5573692ae9cd5d143c2a5. bowerbird and jacana now
fail when they see an unexpected "0" before the exponent:

Jan 09 11:49:51 # debug(script=0,command=29): double 1e+030
...
Jan 09 11:49:51 # doesn't match '(?-xism:command=29.: double 1e\+30\b)'

I think you need to put "0?" back into the pattern like in the attached.

--
Teodor Sigaev E-mail: teodor@sigaev.ru
WWW: http://www.sigaev.ru/

#4Fabien COELHO
coelho@cri.ensmp.fr
In reply to: Teodor Sigaev (#1)
hackerscomitters
Re: pgsql: Improve scripting language in pgbench

Hello Teodor,

I just noticed while rebasing stuff that there is some crust in
"pgbench/t/001_pgbench_with_server.pl" coming from this patch:

  +=head
  +
  +} });
  +
  +=cut

I cannot find any use for these lines which are ignored by perl execution
anyway. It may be some leftovers from debugging which got past everyone.
If so, I think that it is better removed, see the attached cleanup patch.

--
Fabien.

Attachments:

pgbench-tap-test-typo.patchtext/x-diff; name=pgbench-tap-test-typo.patchDownload+0-6
#5Peter Eisentraut
peter_e@gmx.net
In reply to: Fabien COELHO (#4)
hackerscomitters
Re: pgsql: Improve scripting language in pgbench

On 1/10/18 07:36, Fabien COELHO wrote:

I just noticed while rebasing stuff that there is some crust in
"pgbench/t/001_pgbench_with_server.pl" coming from this patch:

+=head
+
+} });
+
+=cut

I cannot find any use for these lines which are ignored by perl execution
anyway. It may be some leftovers from debugging which got past everyone.
If so, I think that it is better removed, see the attached cleanup patch.

fixed

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services