Re: [HACKERS] pgbench more operators & functions

Поиск
Список
Период
Сортировка
От Teodor Sigaev
Тема Re: [HACKERS] pgbench more operators & functions
Дата
Msg-id 992df164-6bb0-6a88-1d03-a97d891d715b@sigaev.ru
обсуждение исходный текст
Ответ на Re: [HACKERS] pgbench more operators & functions  (Fabien COELHO <coelho@cri.ensmp.fr>)
Ответы Re: [HACKERS] pgbench more operators & functions
Список 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;
  case
------
    33

-- 
Teodor Sigaev                                   E-mail: teodor@sigaev.ru
                                                    WWW: http://www.sigaev.ru/


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

Предыдущее
От: Victor Yagofarov
Дата:
Сообщение: Why standby restores some WALs many times from archive?
Следующее
От: Antonio Belloni
Дата:
Сообщение: Re: Contributing some code