/alter/table/columns

URL: http://<db.host>:<db.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, including whether it is dictionary encoded or not.

Input Parameter Description

NameTypeDescription
table_namestringTable on which the operation will be performed. Must be an existing table or view, in [schema_name.]table_name format, using standard name resolution rules.
column_alterationsarray of maps of string to stringsList 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'}]
optionsmap of string to stringsOptional 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:

NameTypeDescription
statusString'OK' or 'ERROR'
messageStringEmpty if success or an error message
data_typeString'alter_table_columns_response' or 'none' in case of an error
dataStringEmpty string
data_strJSON or String

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

NameTypeDescription
table_namestringTable on which the operation was performed.
type_idstringreturn the type_id (when changing a table, a new type may be created)
type_definitionstringreturn the type_definition (when changing a table, a new type may be created)
propertiesmap of string to arrays of stringsreturn the type properties (when changing a table, a new type may be created)
labelstringreturn the type label (when changing a table, a new type may be created)
column_alterationsarray of maps of string to stringsList 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'}]
infomap of string to stringsAdditional information.

Empty string in case of an error.