---
title: "ALTER PUBLICATION"
url: "https://docs.yugabyte.com/stable/api/ysql/the-sql-language/statements/ddl_alter_publication/"
---

# ALTER PUBLICATION

Change properties of an existing publication.

## Synopsis

Use the `ALTER PUBLICATION` statement to change properties of an existing publication.

## Syntax

- [![Grammar Icon](/icons/file-lines.svg)Grammar](#grammar-1)
- [![Diagram Icon](/icons/diagram.svg)Diagram](#diagram-1)

```output.ebnf
alter_publication ::= ALTER PUBLICATION publication_name 
                      [ alter_publication_action [ , ... ] ]

alter_publication_action ::= ADD TABLE table_name [ , ... ]
                             | SET TABLE table_name [ , ... ]
                             | DROP TABLE table_name [ , ... ]
                             | RENAME TO publication_name
                             | OWNER TO new_owner
```

#### alter\_publication

ALTERPUBLICATION[publication\_name](/stable/api/ysql/syntax_resources/grammar_diagrams#publication-name),[alter\_publication\_action](#alter-publication-action)

#### alter\_publication\_action

ADDTABLE,[table\_name](/stable/api/ysql/syntax_resources/grammar_diagrams#table-name)SETTABLE,[table\_name](/stable/api/ysql/syntax_resources/grammar_diagrams#table-name)DROPTABLE,[table\_name](/stable/api/ysql/syntax_resources/grammar_diagrams#table-name)RENAMETO[publication\_name](/stable/api/ysql/syntax_resources/grammar_diagrams#publication-name)OWNERTO[new\_owner](/stable/api/ysql/syntax_resources/grammar_diagrams#new-owner)

## Semantics

### *alter\_publication\_action*

Specify one of the following actions.

#### ADD TABLE *table\_name { ',' table\_name }*

Add the specified tables to the publication.

#### SET TABLE *table\_name { ',' table\_name }*

Replace the list of tables/schemas in the publication with the specified list. The existing tables/schemas that were present in the publication will be removed.

#### DROP TABLE *table\_name { ',' table\_name }*

Remove the specified tables from the publication.

#### RENAME TO *publication\_name*

Rename the publication name to the specified name.

#### OWNER TO *new\_owner*

Change the owner of the publication to the *new\_owner*.

### Permissions

To alter a publication, the invoking user must own the publication. Adding a table to a publication additionally requires owning that table. To alter the owner, you must also be a direct or indirect member of the new owning role. The new owner must have `CREATE` privilege on the database. Also, the new owner of a `FOR ALL TABLES` publication must be a superuser. However, a superuser can change the ownership of a publication regardless of these restrictions.

## Examples

Assume that you have created the tables `users`, `departments`, and `employees`.

To create a publication `my_publication`, use the following command:

```sql
yugabyte=# CREATE PUBLICATION my_publication FOR TABLE employees;
```

Add the `users` and `departments` tables to the publication `my_publication`:

```sql
yugabyte=# ALTER PUBLICATION my_publication ADD TABLE users, departments;
```

Drop the `employees` table from the publication `my_publication`:

```sql
yugabyte=# ALTER PUBLICATION my_publication DROP TABLE employees;
```

Set the `departments` table to be the only table in the publication `my_publication`. The table `users` will be removed from the publication as a result of the command.

```sql
yugabyte=# ALTER PUBLICATION my_publication SET TABLE departments;
```

Rename the publication `my_publication` to `renamed_publication`.

```sql
yugabyte=# ALTER PUBLICATION my_publication RENAME TO renamed_publication;
```

## See also

- [CREATE PUBLICATION](/stable/api/ysql/the-sql-language/statements/ddl_create_publication "CREATE PUBLICATION")
- [DROP PUBLICATION](/stable/api/ysql/the-sql-language/statements/ddl_drop_publication "DROP PUBLICATION")
