gprestore --redirect-schema error for CREATE FUNCTION
search cancel

gprestore --redirect-schema error for CREATE FUNCTION

book

Article ID: 384249

calendar_today

Updated On:

Products

VMware Tanzu Greenplum Greenplum Pivotal Data Suite Non Production Edition VMware Tanzu Data Suite VMware Tanzu Data Suite

Issue/Introduction

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

Cause

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".

Resolution

Workaround

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.

Fix

As of Dec 2024, fix is being developed and will be released in a future version of gprestore.