Version:

/alter/tableΒΆ

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

Apply various modifications to a table or collection. Available modifications include:

Creating or deleting an index on a particular column. This can speed up certain search queries (such as /get/records, /delete/records, /update/records) when using expressions containing equality or relational operators on indexed columns. This only applies to child tables.

Making a table protected or not. Protected tables need the admin password to be sent in a /clear/table to delete the table. This can be applied to child tables or collections or views.

Setting the time-to-live (TTL). This can be applied to tables, views, or collections. When applied to collections, every table & view within the collection will have its TTL set to the given value.

Allowing homogeneous child tables. This only applies to collections.

Input Parameter Description

Name Type Description
table_name string Table on which the operation will be performed. Must be a valid table or collection in GPUdb.
action string

Modification operation to be applied to the table or collection

Supported Values Description
create_index Creates an index on the column name specified in input parameter value. If this column is already indexed, GPUdb will return an error.
delete_index Deletes an existing index on the column name specified in input parameter value. If this column does not have indexing turned on, GPUdb will return an error.
allow_homogeneous_tables Sets whether homogeneous child tables are allowed in the given collection. This action is only valid if input parameter table_name is a collection. input parameter value must be either 'true' or 'false'.
protected Sets whether the given input parameter table_name should be protected or not. input parameter value must be either 'true' or 'false'.
ttl Sets the time-to-live (TTL) of the table, view, or collection specified in input parameter table_name. input parameter value must be the desired TTL in minutes.
value string The value of the modification. May be a column name, 'true' or 'false', or a time-to-live depending on input parameter action.
options map of strings Optional parameters. Default value is an empty map ( {} ).

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_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 endpoint:

Name Type Description
table_name string Table on which the operation was performed.
action string Modification operation that was performed.
value string The value of the modification that was performed.

Empty string in case of an error.