Error running legacy.sql

Error running legacy.sql

I'm trying tu run legacy.sql in order to recover some functions to add support for an older version of MapServer.
Example of function in legacy.sql file:

CREATE OR REPLACE FUNCTION AsBinary(geometry)
...