Re: pgbench more operators & functions

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pgbench more operators & functions
Date: 2017-09-09 09:02:03
Message-ID: alpine.DEB.2.20.1709091037280.3568@lancre
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

Attachment Content-Type Size
pgbench-more-ops-funcs-13.patch text/x-diff 44.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2017-09-09 09:39:50 Re: Still another race condition in recovery TAP tests
Previous Message Michael Paquier 2017-09-09 08:54:01 Re: Setting pd_lower in GIN metapage