Re: [HACKERS] pgbench more operators & functions

From: Teodor Sigaev <teodor(at)sigaev(dot)ru>
To: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
Cc: Raúl Marín Rodríguez <rmrodriguez(at)carto(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] pgbench more operators & functions
Date: 2017-12-28 13:42:45
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

> Here is a rebase after "pow" addition.

Huh, you are fast.

Investigating your patch I found that all arguments of logical AND/OR and CASE
are always evaluated. Seems, it should not be for pair of reasons:
- computing of unneeded args could be too expensive
- computing of unneeded args could complicate scripting code, look:
\set zy 0
\set yz case when :zy = 0 then -1 else (1 / :zy) end
This example will fail although programmer tried to check forbidden value

case when 1>0 then 1 when 1/0 > 0 then 0 else -1 end -- fails too

SQL doesn't evaluate unneeded arguments:
select case when 1>0 then 33 when 1/0 > 0 then -33 else null end;

Teodor Sigaev E-mail: teodor(at)sigaev(dot)ru

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Antonio Belloni 2017-12-28 15:00:30 Re: Contributing some code
Previous Message Thomas Munro 2017-12-28 13:21:01 Re: pgsql: Add parallel-aware hash joins.