/create/table

URL: http://<db.host>:<db.port>/create/table

Creates a new table. If a new table is being created, the type of the table is given by input parameter type_id, which must be the ID of a currently registered type (i.e. one created via /create/type).

A table may optionally be designated to use a replicated distribution scheme, or be assigned: foreign keys to other tables, a partitioning scheme, and/or a tier strategy.

Input Parameter Description

NameTypeDescription
table_namestringName of the table to be created, in [schema_name.]table_name format, using standard name resolution rules and meeting table naming criteria. Error for requests with existing table of the same name and type ID may be suppressed by using the no_error_if_exists option.
type_idstringID of a currently registered type. All objects added to the newly created table will be of this type.
optionsmap of string to strings

Optional parameters. The default value is an empty map ( {} ).

Supported Parameters (keys)Parameter Description
no_error_if_exists

If true, prevents an error from occurring if the table already exists and is of the given type. If a table with the same ID but a different type exists, it is still an error. The default value is false. The supported values are:

  • true
  • false
create_temp_table

If true, a unique temporary table name will be generated in the sys_temp schema and used in place of input parameter table_name. If is_result_table is true, then this is always allowed even if the caller does not have permission to create tables. The generated name is returned in qualified_table_name. The default value is false. The supported values are:

  • true
  • false
collection_name[DEPRECATED--please specify the containing schema as part of input parameter table_name and use /create/schema to create the schema if non-existent] Name of a schema which is to contain the newly created table. If the schema is non-existent, it will be automatically created.
is_collection

[DEPRECATED--please use /create/schema to create a schema instead] Indicates whether to create a schema instead of a table. The default value is false. The supported values are:

  • true
  • false
disallow_homogeneous_tables

No longer supported; value will be ignored. The default value is false. The supported values are:

  • true
  • false
is_replicated

Affects the distribution scheme for the table's data. If true and the given type has no explicit shard key defined, the table will be replicated. If false, the table will be sharded according to the shard key specified in the given input parameter type_id, or randomly sharded, if no shard key is specified. Note that a type containing a shard key cannot be used to create a replicated table. The default value is false. The supported values are:

  • true
  • false
foreign_keysSemicolon-separated list of foreign keys, of the format '(source_column_name [, ...]) references target_table_name(primary_key_column_name [, ...]) [as foreign_key_name]'.
foreign_shard_keyForeign shard key of the format 'source_column references shard_by_column from target_table(primary_key_column)'.
partition_type

Partitioning scheme to use.

Supported ValuesDescription
RANGEUse range partitioning.
INTERVALUse interval partitioning.
LISTUse list partitioning.
HASHUse hash partitioning.
SERIESUse series partitioning.
partition_keysComma-separated list of partition keys, which are the columns or column expressions by which records will be assigned to partitions defined by partition_definitions.
partition_definitionsComma-separated list of partition definitions, whose format depends on the choice of partition_type. See range partitioning, interval partitioning, list partitioning, hash partitioning, or series partitioning for example formats.
is_automatic_partition

If true, a new partition will be created for values which don't fall into an existing partition. Currently only supported for list partitions. The default value is false. The supported values are:

  • true
  • false
ttlSets the TTL of the table specified in input parameter table_name.
chunk_sizeIndicates the number of records per chunk to be used for this table.
is_result_table

Indicates whether the table is a memory-only table. A result table cannot contain columns with store_only or text_search data-handling or that are non-charN strings, and it will not be retained if the server is restarted. The default value is false. The supported values are:

  • true
  • false
strategy_definitionThe tier strategy for the table and its columns.

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'create_table_response' or 'none' in case of an error
dataStringEmpty string
data_strJSON or String

This embedded JSON represents the result of the /create/table endpoint:

NameTypeDescription
table_namestringValue of input parameter table_name.
type_idstringValue of input parameter type_id.
is_collectionboolean[DEPRECATED--this will always return false] Indicates if the created entity is a schema.
infomap of string to strings

Additional information. The default value is an empty map ( {} ).

Possible Parameters (keys)Parameter Description
qualified_table_nameThe fully qualified name of the new table (i.e. including the schema)

Empty string in case of an error.