View a markdown version of this page

DROP SCALEOUT ROUTING FUNCTION - Amazon Aurora

DROP SCALEOUT ROUTING FUNCTION

Use DROP SCALEOUT ROUTING FUNCTION to remove a routing function from a database cluster group for Aurora.

Description and syntax

Removes a routing function that no scaleout table uses. Data mappings, member tables, and rows stay as they are.

DROP SCALEOUT ROUTING FUNCTION function_name;

Parameters and options

The statement takes the following parameter.

function_name

The routing function to remove.

Where it runs and required privileges

Run the statement at the routing endpoint, in a session that isn't pinned, outside a transaction. For the details, see Where these statements run.

The router user needs dbclustergroup_metadata_admin or dbclustergroup_super_admin. For all privileges for database cluster groups for Aurora, see Privileges.

Usage notes

Keep the following in mind when you use the statement.

  • You can't drop a function that a scaleout table uses, directly or through USING ROUTING FUNCTION OF. Drop or switch those tables first.

  • Save the function's SHOW CREATE SCALEOUT ROUTING FUNCTION output first. You can't read back a dropped function.

  • To remove a scaleout table and its function, follow the reverse of the order of creation.

Examples

The following example drops tenant_rf after orders has switched to tenant_rf_v2.

DROP SCALEOUT ROUTING FUNCTION tenant_rf;

Errors

The statement can return the following errors. For all errors from the routing layer, see Error codes for database cluster groups for Aurora.

Aurora MySQL Meaning
64042 Cannot drop routing function '<function_name>' referenced by scaleout tables (42000) A scaleout table still uses the function.
1064 Syntax error: a form outside the grammar.
1227 Access denied; you need the '<PRIVILEGE>' privilege for this operation The router user lacks the privilege for database cluster groups for Aurora.

For more information, see the following: