Postgresql Explain Nested If With Example