15.00 - CREATE TABLE - Teradata Database

Teradata Database SQL Data Definition Language Detailed Topics

prodname
Teradata Database
vrm_release
15.00
category
Programming Reference
featnum
B035-1184-015K

CREATE TABLE

General Table Restrictions On Using UDT Columns

The general restrictions on the use of UDT columns in tables are the following.

  • Constraint definitions cannot be specified for Geospatial, BLOB, CLOB, JSON, XML, ARRAY, VARRAY, or Period columns. Geospatial and Period data types are implemented internally as UDTs. See “PRIMARY KEY Constraints” on page 557, and “FOREIGN KEY Constraints” on page 561.
  • This restriction does not apply to PRIMARY KEY and UNIQUE constraints, which can be specified for non‑LOB UDT columns.

  • Index definitions cannot include any Geospatial, BLOB, CLOB, JSON, XML, ARRAY, VARRAY, or Period columns. See “Primary Indexes” on page 575 and “Secondary Indexes” on page 649.
  • The partitioning expression of a table cannot reference any UDT, BLOB, CLOB, JSON, XML, Geospatial, ARRAY, VARRAY, or Period columns. See “Rules and Usage Notes for Partitioned Tables” on page 625.
  • A table containing ARRAY, VARRAY, Period or Geospatial columns must have at least 1 non‑Period or Geospatial column because an ARRAY, VARRAY, Period or Geospatial column cannot be a component of an index.
  • With the exception of unpartitioned NoPI tables (see “Unpartitioned NoPI Tables” on page 575) and column‑partitioned tables (see “Column‑Partitioned Tables” on page 577), each table is required to have a primary index.

  • The first column of the table cannot have a Geospatial, ARRAY, VARRAY, or Period data type if the PRIMARY KEY or UNIQUE attribute is not specified for any of the non-UDT columns.
  • If you attempt to create such a table, the request aborts and the system returns an error to the requestor because an ARRAY, VARRAY, Geospatial, or Period column cannot be the primary index for a table, whether by default or by design.

  • A UDT must have both of the following defined prior to its usage as a column type in any table.
  • An ordering (see “CREATE ORDERING/ REPLACE ORDERING” on page 416).
  • A transform group (see “CREATE TRANSFORM/ REPLACE TRANSFORM” on page 694).
  • Because ARRAY, VARRAY, Geospatial, and Period data types are implemented internally as UDTs, you do not have to define ordering and transform definitions for them.

    An attempt to create a table containing an ARRAY, VARRAY, Geospatial, or Period column that lacks an ordering definition, a transform definition, or both, returns an error to the requestor.

    See “Prerequisites for Specifying a UDT, ARRAY, VARRAY, Period, or Geospatial Column in a Table Definition” on page 537.

  • Table header space is reduced for each UDT, ARRAY, VARRAY, Geospatial, or Period column specified in a table definition.
  • Each UDT column declared consumes approximately 80 bytes of table header space. Depending on other options you declare for a table, including multi-value and algorithmic compression, partitioned primary indexes, secondary indexes, and so on, the table header size limit can eventually be exceeded, aborting the request and returning an error message to the requestor.

    In the absence of other feature specifications, the limit on the number of UDT, ARRAY, VARRAY, Geospatial, and Period columns per table is approximately 1,600 columns. This assumes that your system permits fat table headers. See Database Design for details about table headers.