17.1. Создание столбца (metastore.add_column) #

Требуемые права: только администратор Postgres Pro AXE. За полным списком хранимых процедур и прав обратитесь к Разделу 12.1.

Выполните следующую команду на сервере Postgres Pro AXE:

  SELECT metastore.add_column('имя_таблицы', 'имя_столбца', 'тип_данных');

Где:

  • имя_таблицы: имя аналитической таблицы, в которой создан столбец.

    Можно указать полное имя в формате имя_схемы.имя_таблицы или просто имя таблицы. Если не указать имя аналитической схемы, используется текущая схема.

  • имя_столбца: уникальное имя столбца.

    В аналитической таблице не должно быть столбца с таким же именем.

  • тип_данных: тип данных столбца.

    За подробной информацией о поддерживаемых типах данных обратитесь к Разделу C.2.

Postgres Pro AXE выполняет следующие действия:

  1. Проверяет параметры ввода и права пользователя.

  2. Создаёт новую запись в таблице метаданных pga_snapshot.

  3. Обновляет значение view_sql для аналитической таблицы.

Пример 17.1. Выполнение хранимой процедуры metastore.add_column

  SELECT metastore.add_column('testtable', 'third_col', 'uint8');

17.1. Creating a Column (metastore.add_column) #

Required privileges: Postgres Pro AXE administrator only. For a full list of stored procedures and privileges, refer to Section 12.1.

Execute the following command on the Postgres Pro AXE server:

  SELECT metastore.add_column('table_name', 'column_name', 'data_type');

Where:

  • table_name: The name of the analytical table where the column is created.

    It can be specified as a fully qualified name in the schema_name.table_name format, or as just the table name. If you do not specify the analytical schema name, the current schema is used.

  • column_name: The unique column name.

    A column with this name must not exist in the analytical table.

  • data_type: The data type of the column.

    For more information about supported data types, refer to Section C.2.

Postgres Pro AXE performs the following actions:

  1. Checks input parameters and user privileges.

  2. Creates a new entry in the pga_column metadata table.

  3. Updates the view_sql value for the analytical table.

Example 17.1. Executing the metastore.add_column Stored Procedure

  SELECT metastore.add_column('testtable', 'third_col', 'uint8');

FAQ