> ## Documentation Index
> Fetch the complete documentation index at: https://docs.risingwave.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ALTER SUBSCRIPTION

> The `ALTER SUBSCRIPTION` command modifies the definition of a subscription.

## Syntax

```sql theme={null}
ALTER SUBSCRIPTION subscription_name
    alter_option;
```

`alter_option` depends on the operation you want to perform on the subscription. For all supported clauses, see the sections below.

## Clauses

### `OWNER TO`

```sql theme={null}
ALTER SUBSCRIPTION current_subscription_name
    OWNER TO new_user;
```

| Parameter or clause | Description                                           |
| :------------------ | :---------------------------------------------------- |
| **OWNER TO**        | This clause changes the owner of the subscription.    |
| *new\_user*         | The new owner you want to assign to the subscription. |

```sql theme={null}
-- Change the owner of the subscription named "sub" to user "admin"
ALTER SUBSCRIPTION sub OWNER TO admin;
```

### `RENAME TO`

```sql theme={null}
ALTER SUBSCRIPTION subscription_name
    RENAME TO new_name;
```

| Parameter or clause | Description                                       |
| :------------------ | :------------------------------------------------ |
| **RENAME TO**       | This clause changes the name of the subscription. |
| *new\_name*         | The new name of the subscription.                 |

```sql theme={null}
-- Rename the subscription named "sub0" to "sub1"
ALTER SUBSCRIPTION sub0 RENAME TO sub1;
```

### `SET SCHEMA`

```sql theme={null}
ALTER SUBSCRIPTION current_subscription_name
    SET SCHEMA schema_name;
```

| Parameter or clause | Description                                                     |
| :------------------ | :-------------------------------------------------------------- |
| **SET SCHEMA**      | This clause moves the subscription to a different schema.       |
| *schema\_name*      | The name of the schema to which the subscription will be moved. |

```sql theme={null}
-- Move the subscription named "test_subscription" to the schema named "test_schema"
ALTER SUBSCRIPTION test_subscription SET SCHEMA test_schema;
```

### `SWAP WITH`

```sql theme={null}
ALTER SUBSCRIPTION name
SWAP WITH target_name;
```

| Parameter      | Description                                                |
| :------------- | :--------------------------------------------------------- |
| *name*         | The current name of the subscription to swap.              |
| *target\_name* | The target name of the subscription you want to swap with. |

```sql theme={null}
-- Swap the names of the user_updates subscription and the admin_updates subscription.
ALTER SUBSCRIPTION user_updates
SWAP WITH admin_updates;
```
