Re: extend pgbench expressions with functions

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: extend pgbench expressions with functions
Дата
Msg-id CA+TgmoaDz0x02wLvsGM0AUtJE-F6E55KpfOmXvmX-mmygzYw1Q@mail.gmail.com
обсуждение исходный текст
Ответ на Re: extend pgbench expressions with functions  (Fabien COELHO <coelho@cri.ensmp.fr>)
Ответы Re: extend pgbench expressions with functions  (Fabien COELHO <coelho@cri.ensmp.fr>)
Re: extend pgbench expressions with functions  (Fabien COELHO <coelho@cri.ensmp.fr>)
Re: extend pgbench expressions with functions  (Fabien COELHO <fabien.coelho@mines-paristech.fr>)
Список pgsql-hackers
On Wed, Jan 27, 2016 at 3:39 AM, Fabien COELHO <coelho@cri.ensmp.fr> wrote:
> Attached is a rebase after recent changes in pgbench code & doc.

+/* use short names in the evaluator */
+#define INT(v) coerceToInt(&v)
+#define DOUBLE(v) coerceToDouble(&v)
+#define SET_INT(pv, ival) setIntValue(pv, ival)
+#define SET_DOUBLE(pv, dval) setDoubleValue(pv, dval)

I don't like this at all.  It seems to me that this really obscures
the code.  The few extra characters are a small price to pay for not
having to go look up the macro definition to understand what the code
is doing.

The third hunk in pgbench.c unnecessary deletes a blank line.
       /*        * inner expresion in (cut, 1] (if parameter > 0), rand in [0, 1)
+        * Assert((1.0 - cut) != 0.0);        */
-       Assert((1.0 - cut) != 0.0);       rand = -log(cut + (1.0 - cut) * uniform) / parameter;
+

Moving the Assert() into the comment seems like a bad plan.  If the
Assert is true, it shouldn't be commented out.  If it's not, it
shouldn't be there at all.

Commit e41beea0ddb74ef975f08b917a354ec33cb60830, which you wrote, went
to some trouble to display good context for error messages.  What you
have here seems like a huge step backwards:

+                       fprintf(stderr, "double to int overflow for
%f\n", dval);
+                       exit(1);

So, we're just going to give up on all of that error context reporting
that we added back then?  That would be sad.

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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Igal @ Lucee.org"
Дата:
Сообщение: Re: Implementing a new Scripting Language
Следующее
От: Robert Haas
Дата:
Сообщение: Re: Patch: ResourceOwner optimization for tables with many partitions