Re: [HACKERS] pgbench more operators & functions - Mailing list pgsql-hackers

From Fabien COELHO
Subject Re: [HACKERS] pgbench more operators & functions
Date
Msg-id alpine.DEB.2.20.1709091037280.3568@lancre
Whole thread Raw
In response to Re: [HACKERS] pgbench more operators & functions  (Fabien COELHO <coelho@cri.ensmp.fr>)
Responses Re: [HACKERS] pgbench more operators & functions
List pgsql-hackers
Hello Pavel,

Here is a v13. No code changes, but TAP tests added to maintain pgbench 
coverage to green.


Summary of patch contents:

This patch extends pgbench expressions syntax while keeping 
compatibility with SQL expressions.

It adds support for NULL and BOOLEAN, as well as assorted logical, 
comparison and test operators (AND, <>, <=, IS NULL...).

A CASE construct is provided which takes advantage of the added BOOLEAN.

Integer and double functions and operators are also extended: bitwise 
operators (<< & ...), exp/ln, mod() as synonymous to % (matching pg).

Added TAP tests maintain pgbench source coverage to green (if you ignore 
lexer & parser generated files...).


Future plans include extending and synchronizing psql & pgbench variable 
and expression syntaxes:
  - move expression parsing and evaluation in fe_utils,
    which would allow to
  - extend psql with some \let i <expression> cliend-side syntax
    (ISTM that extending the \set syntax cannot be upward compatible)
    and probably handle \let as a synonymous to \set in pgbench.
  - allow \if <expression> in psql instead of just \if <boolean>
  - add \if ... support to pgbench
  - maybe add TEXT type support to the expression engine, if useful
  - maybe add :'var" and :"var" support to pgbench, if useful

There are already patches in the queue for:
  - testing whether a variable is defined in psql
    feature could eventually be added to pgbench as well
  - adding \gset (& \cset) to pgbench to get output of possibly
    combined queries into variables, which can be used for making
    decisions later in the script.

-- 
Fabien.
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachment

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: [HACKERS] Setting pd_lower in GIN metapage
Next
From: Michael Paquier
Date:
Subject: Re: [HACKERS] Still another race condition in recovery TAP tests