title: Select with IF statement on postgresql
body: <p>I have a code like that:</p>
  
  <pre><code>select
      tbl.person
      ,COUNT(distinct tbl.project)
      ,if (tbl.stage like '%SIGNED%') then sum(tbl.value) else '0' end if as test
  from
      my_table tbl
  group by
  1
  
  </code></pre>
  
  <p>And it returns me that error message:</p>
  
  <pre><code>SQL Error [42601]: ERROR: syntax error at or near "then"
  </code></pre>
  
  <p>I didn't got it. As I saw on documentation, the if statement syntax appears to be used correctly </p>