NULLIF Function - SQL Server to PostgreSQL Migration

In SQL Server and PostgreSQL the NULLIF function returns NULL is two expressions are equal otherwise it returns the first expression

SQL Server:

  -- Return NULL if expressions are equal
  SELECT NULLIF(1, 1);
  # NULL 
 
  -- Returns the first expression
  SELECT NULLIF(1, 3);
  # 1

PostgreSQL:

  -- Return NULL if expressions are equal
  SELECT NULLIF(1, 1);
  # NULL 
 
  -- Returns the first expression
  SELECT NULLIF(1, 3);
  # 1

For more information, see SQL Server to PostgreSQL Migration.