In PostgreSQL, the quote_nullable() function returns a given string suitably quoted to be used as a string literal in a SQL statement string. It returns the actual string NULL if the argument is null.
Any embedded single-quotes and backslashes are properly doubled.