why from_utf8 does not exist in postgresql? I have the following sql code that uses from_utf8 function:
SELECT FROM_UTF8(name, ’?’) AS name, COUNT(DISTINCT target) AS cnt
FROM directory_entry_file GROUP BY name
ORDER BY cnt DESC
LIMIT 1;

When I execute this query in the postgresql, I get the following error:
ERROR:  function from_utf8(unix_path, unknown) does not exist
LINE 1: SELECT FROM_UTF8(name, '?') AS name, COUNT(DISTINCT target) ...
               ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.

How can I fix this error?
As documented in the the manual the function you are looking for is convert_from()

Converts a binary string representing text in encoding src_encoding to text in the database encoding

So the query should probably be:
SELECT convert_from(name, 'UTF8') AS name, 
       COUNT(DISTINCT target) AS cnt
FROM directory_entry_file 
GROUP BY convert_from(name, 'UTF-8')
ORDER BY cnt DESC
LIMIT 1;