In SQL Server, the LEN function returns the length of the string in characters excluding trailing spaces.
In PostgreSQL, you can use the LENGTH function that includes the traling blanks, so you can also apply the RTRIM function if you want to exclude them.
SQL Server:
-- Get the string length SELECT LEN('Hello'); # 5 -- Trailing blanks are not included (!) SELECT LEN('Hello '); # 5
PostgreSQL:
-- Get the string length SELECT LENGTH('Hello'); # 5 -- Trailing blanks are included (!) SELECT LENGTH('Hello '); # 7 -- Excluding the trailing blanks SELECT LENGTH(RTRIM('Hello ')); # 5
For more information, see SQL Server to PostgreSQL Migration.