Re: extend pgbench expressions with functions

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
Cc: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: extend pgbench expressions with functions
Date: 2015-09-18 17:10:29
Message-ID: CA+TgmoYJYV6c3bMvJTQxhhjjfWSOdEhDAG1kaweMgQ7cqdCJGQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Sep 17, 2015 at 10:58 PM, Kyotaro HORIGUCHI
<horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp> wrote:
> By the way, the complexity comes from separating integer and
> double. If there is no serios reason to separate them, handling
> all values as double makes things far simpler.

-1. double is an inexact type, whereas integer is an exact type.

The typical way to handle this sort of thing is to define a struct
whose first member is a type field and whose second field is a union
of all the types you need to care about. Then that gets passed around
everywhere. This patch should be designed in such a way that if we
eventually end up with functions that have 10 different return types
instead of 2 different return types, we don't need to add 8 more
parameters to any functions. Instead, those still return
PgBench_Value (or whatever we call it) which is the aforementioned
struct, but there are more options for what that can contain.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2015-09-18 17:16:50 Re: RFC: replace pg_stat_activity.waiting with something more descriptive
Previous Message Robert Haas 2015-09-18 17:06:53 Re: numbering plan nodes