Materialize Documentation
s
Join the Community github/materialize

ALTER ... RENAME

New in v0.4.0.

ALTER ... RENAME renames an item, albeit with some limitations.

Note that renaming schemas and databases are in development. (#3680)

Syntax

ALTER INDEX SINK SOURCE VIEW TABLE name RENAME TO new_name
Field Use
name The identifier of the item you want to rename.
new_name The new identifier you want the item to use.

Details

Because of Materialize’s SQL engine, we currently only support renaming items in limited contexts.

Rename-able limitations

You cannot rename items if:

New name limitations

You cannot rename an item to any identifier used in a dependent query, whether that identifier is used implicitly or explicitly.

Consider this example:

CREATE VIEW v5 AS
SELECT *
FROM d1.s1.v2
JOIN v1
ON v1.a = v2.b

You could not rename v1 to:

However, you could rename v1 to any other legal identifier.

Examples

SHOW VIEWS;
 VIEWS
-------
 v1
ALTER VIEW v1 RENAME TO v2;
SHOW VIEWS;
 VIEWS
-------
 v2

See also