Version:

/alter/table/columns

URL: http://GPUDB_IP_ADDRESS:GPUDB_PORT/alter/table/columns

Apply various modifications to columns in a table, view. The available modifications include the following:

Create or delete an index on a particular column. This can speed up certain operations when using expressions containing equality or relational operators on indexed columns. This only applies to tables.

Manage a table's columns--a column can be added, removed, or have its type and properties modified.

Set or unset compression for a column.

Input Parameter Description

Name Type Description
table_name string Table on which the operation will be performed. Must be an existing table or view.
column_alterations array of maps of string to strings list of alter table add/delete/change column requests - all for the same table. each request is a map that includes 'column_name', 'action' and the options specific for the action, note that the same options as in alter table requests but in the same map as the column name and the action. For example: [{'column_name':'col_1','action':'change_column','rename_column':'col_2'}, {'column_name':'col_1','action':'add_column', 'type':'int','default_value':'1'} ]
options map of string to strings Optional parameters.

Output Parameter Description

The GPUdb server embeds the endpoint response inside a standard response structure which contains status information and the actual response to the query. Here is a description of the various fields of the wrapper:

Name Type Description
status String 'OK' or 'ERROR'
message String Empty if success or an error message
data_type String 'alter_table_columns_request' or 'none' in case of an error
data String Empty string
data_str JSON or String

This embedded JSON represents the result of the /alter/table/columns endpoint:

Name Type Description
table_name string Table on which the operation was performed.
type_id string return the type_id (when changing a table, a new type may be created)
type_definition string return the type_definition (when changing a table, a new type may be created)
properties map of string to arrays of strings return the type properties (when changing a table, a new type may be created)
label string return the type label (when changing a table, a new type may be created)
column_alterations array of maps of string to strings list of alter table add/delete/change column requests - all for the same table. each request is a map that includes 'column_name', 'action' and the options specific for the action, note that the same options as in alter table requests but in the same map as the column name and the action. For example: [{'column_name':'col_1','action':'change_column','rename_column':'col_2'}, {'column_name':'col_1','action':'add_column', 'type':'int','default_value':'1'} ]
info map of string to strings Additional information.

Empty string in case of an error.