Updated on 2024-11-30 GMT+08:00

Full Synchronization Error: function *** does not exist

Scenarios

During full synchronization, an error is reported, and the log information is as follows: service DATAMOVE failed, cause by: apply event=[type=table_structure, index=%s, schema_name=%s, object_name=%s] occur error, msg=ERROR: function *** does not exist Hint: No function matches the given name and argument types. You might need to add explicit type casts.

Possible Causes

Functions on which the table structure depends are not created in the destination database in advance. In table-level synchronization from PostgreSQL to PostgreSQL, functions and plugin objects cannot be synchronized. Therefore, you need to manually create functions on which the table structure depends in the destination database.

You can log in to the corresponding database in the destination RDS for PostgreSQL and run the following SQL statement to check whether there is the function. In the command, f_name indicates the function name.

select n.nspname,p.proname,pg_get_functiondef(p.oid) as funcdef from pg_proc p left join pg_namespace n on p.pronamespace=n.oid where proname ='f_name';

Solution

The missing function may belong to a plugin or is a user-defined function. Perform the following steps to check the source of the function in the source database, create the corresponding plugin or function in the destination database, and retry the DRS task.

  1. Log in to the source database and run the following SQL statement to query the plugin to which the function belongs (f_name indicates the function name):

    select extname, nspname, proname,pg_get_function_arguments(c.oid) as funcargs from pg_extension e join pg_depend d on (d.refobjid=e.oid) join pg_proc c on (d.objid=c.oid) join pg_namespace n on c.pronamespace=n.oid where proname ='f_name';
    • If a query result is displayed, the function belongs to a plugin. The extname field in the query result indicates the plugin name. Go to 2.
    • If no query result is displayed, the function does not belong to any plugin and is a user-defined function. Go to 3.

  2. If the function belongs to a plugin, click Plugins on the destination RDS for PostgreSQL management page and install the plugin.
  3. If the function is user-defined function, create the same function in the destination database as that in the source database. For details about the function definition statement, see the execution result of the following SQL statement in the source database. f_name indicates the function name.

    select n.nspname,p.proname,pg_get_functiondef(p.oid) as funcdef from pg_proc p left join pg_namespace n on p.pronamespace=n.oid where proname ='f_name';

  4. Retry the DRS task.