Re: pgbench - add \if support

Поиск
Список
Период
Сортировка
От Fabien COELHO
Тема Re: pgbench - add \if support
Дата
Msg-id alpine.DEB.2.20.1801121920140.15795@lancre
обсуждение исходный текст
Ответ на Re: pgbench - add \if support  (Teodor Sigaev <teodor@sigaev.ru>)
Ответы Re: pgbench - add \if support
Список pgsql-hackers
> Hm, isn't already commited when/case/then/else syntax do the same?

No, not strictly. The "CASE WHEN" is an if *within* an expression:

   \set i CASE WHEN condition THEN val1 ELSE val2 END

The \if is at the script level, like psql already available version, which 
can change what SQL is sent.

   \if condition
     SOME SQL
   \else
     OTHER SQL
   \endif

You could achieve the CASE semantics with some \if:

   \if condition
     \set i val1
   \else
     \set i val2
   \endif

But the reverse is not possible.

-- 
Fabien.


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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: [HACKERS] Parallel tuplesort (for parallel B-Tree index creation)
Следующее
От: David Fetter
Дата:
Сообщение: Re: CREATE ROUTINE MAPPING