CREATE EXTENSION iif; SELECT iif(1<0,1,2); iif ----- 2 (1 row) SELECT iif(100>99, 'this is true','this is false'::text); iif -------------- this is true (1 row) SELECT iif(100>99, 'this is true','this is false'); ERROR: could not determine polymorphic type because input has type unknown SELECT iif(1>0, 'this is true'::text,'this is false'); iif -------------- this is true (1 row) SELECT iif(NULL, 'this is true'::text,'this is false'); iif ----- (1 row)