When using gprestore option --redirect-schema during the CREATE FUNCTION an error is encountered:
20241120:05:04:24 gprestore:gpadmin:<servername>-[ERROR]:-Error encountered when executing statement: CREATE FUNCTION old_schema_name.name_of_function()
...
$$
LANGUAGE plpgsql NO SQL; Error was: ERROR: function "name_of_function" already exists with same argument types
The CREATE FUNCTION redirect error happens because gprestore is choosing the wrong method to replace the old schema with the new schema.
The wrong regex (regular expression) is chosen to edit the statement and no changes happen. The redirect is not working on the CREATE FUNCTION statement because the function body contains "GRANT" or "REVOKE".
1. Manually recreate function in the new schema
2. Run gprestore --redirect-db and --redirect-schema --on-error-continue again. The gprestore will be able to continue.
As of Dec 2024, fix is being developed and will be released in a future version of gprestore.