All Products
Search
Document Center

Hologres:ALTER FOREIGN TABLE

Last Updated:Mar 26, 2026

Use ALTER FOREIGN TABLE to rename a foreign table, add columns, or drop columns.

Limitations

Hologres supports ALTER FOREIGN TABLE only for renaming a foreign table, adding columns, and dropping columns.

Rename a foreign table

Syntax:

ALTER FOREIGN TABLE [ IF EXISTS ] name RENAME TO new_name;

Example:

ALTER FOREIGN TABLE test RENAME TO new_test_table;

Add a column

When you add a column to a MaxCompute table, Hologres does not automatically sync the schema change to the mapped foreign table. To query the new column's values, manually add the column to the foreign table.

Note

Shared clusters do not support adding columns using this syntax. For shared clusters, use IMPORT FOREIGN SCHEMA instead.

Syntax:

ALTER FOREIGN TABLE IF EXISTS table_name ADD COLUMN new_column_name data_type;

Example:

ALTER FOREIGN TABLE bank
  ADD COLUMN cons_conf_idx float8,
  ADD COLUMN euribor3m float8;

Drop a column

Syntax:

ALTER FOREIGN TABLE IF EXISTS table_name DROP COLUMN column_name;

Example:

ALTER FOREIGN TABLE bank
  DROP COLUMN cons_conf_idx;