Each value that Amazon Redshift stores or retrieves has a data type with a fixed set of associated properties. Data types are declared when tables are created. A data type constrains the set of values that a column or argument can contain.
The following table lists the data types that you can use in Amazon Redshift tables.
|SMALLINT||INT2||Signed two-byte integer|
|INTEGER||INT, INT4||Signed four-byte integer|
|BIGINT||INT8||Signed eight-byte integer|
|DECIMAL||NUMERIC||Exact numeric of selectable precision|
|REAL||FLOAT4||Single precision floating-point number|
|DOUBLE PRECISION||FLOAT8, FLOAT||Double precision floating-point number|
|BOOLEAN||BOOL||Logical Boolean (true/false)|
|CHAR||CHARACTER, NCHAR, BPCHAR||Fixed-length character string|
|VARCHAR||CHARACTER VARYING, NVARCHAR, TEXT||Variable-length character string with a user-defined limit|
|DATE||Calendar date (year, month, day)|
|TIMESTAMP||TIMESTAMP WITHOUT TIME ZONE||Date and time (without time zone)|
The VARCHAR data type supports UTF-8 multibyte characters up to a maximum of four bytes. Five-byte or longer characters are not supported. To calculate the size of a VARCHAR column that contains multibyte characters, multiply the number of characters by the number of bytes per character. For example, if a string has four Chinese characters, and each character is three bytes long, then you will need a VARCHAR(12) column to store the string.
VARCHAR does not support the following invalid UTF-8 codepoints:
0xD800 - 0xDFFF
(Byte sequences: ED A0 80 - ED BF BF)
0xFDD0 - 0xFDEF, 0xFFFE, and 0xFFFF
(Byte sequences: EF B7 90 - EF B7 AF, EF BF BE, and EF BF BF)
The CHAR data type does not support multibyte characters.