Data of various types are used to:
-
Define columns in a database table in the
CREATE TABLE
statement or change columns usingALTER TABLE
-
Declare or change a domain using the
CREATE DOMAIN
orALTER DOMAIN
statements -
Declare local variables, return values and parameters in PSQL modules and UDFs — user-defined functions
-
Provide arguments for the
CAST()
function when explicitly converting data from one type to another
Name | Size | Precision & Limits | Description |
---|---|---|---|
|
64 bits |
From -263 to (263 - 1) |
Signed 64-bit integer.This data type is available in Dialect 3 only |
|
n bytes |
from 1 to 32,767 bytes |
A fixed-length binary data type;synonym for |
|
Varying |
The size of a |
A data type of variable size for storing large amounts of data, such as images, text, digital sounds.The blob subtype defines its content.Depending on the page size, |
|
1 byte |
false, true, unknown |
Boolean data type |
|
n characters.Size in bytes depends on the encoding, the number of bytes in a character |
from 1 to 32,767 bytes |
A fixed-length character data type.Values shorter than the declared length are padded with spaces (0x20) — or NUL (0x00) for character set OCTETS — up to the declared length.If the number of characters is not specified, 1 is used by default. |
|
4 bytes |
From 0001-01-01 AD to 9999-12-31 AD |
Date only, no time element |
|
64 or 128 bits |
dec_prec = 16 or 34, defines the number of decimal digits |
Decimal floating-point type, IEEE-754 decimal64 or decimal128.If the precision is not specified, 34 is used by default. |
|
Varying (16, 32, 64 or 128 bits) |
precision = from 1 to 38, defines the minimum number of digits to store;scale = from 0 to 38, defines the number of digits after the decimal point |
A number with a decimal point that has scale digits after the point.scale must be less than or equal to precision.Example: |
|
64 bits |
2.225 * 10-308 to 1.797 * 10308 |
Double-precision, IEEE-754 binary64, ~15 digits, reliable size depends on the platform |
|
32 bits |
1.175 * 10-38 to 3.402 * 1038 |
Single-precision, IEEE-754 binary32, ~7 digits |
|
32 or 64 bits |
bin_prec = from 1 to 53, binary precision |
Binary precision 1 - 24: synonym for |
|
32 bits |
-2,147,483,648 up to 2,147,483,647 |
Signed 32-bit integer |
|
128 bits |
From -2127 to (2127 - 1) |
Signed 128-bit integer |
|
Varying (16, 32, 64 or 128 bits) |
precision = from 1 to 38, defines the minimum number of digits to store;scale = from 0 to 38, defines the number of digits after the decimal point |
A number with a decimal point that has scale digits after the point.scale must be less than or equal to precision.Example: |
|
32 bits |
|
Synonym for |
|
16 bits |
-32,768 to 32,767 |
Signed short (word) |
|
4 bytes |
0:00 to 23:59:59.9999 |
Time of day.It cannot be used to store an interval of time. |
|
6 bytes |
0:00 to 23:59:59.9999 |
Time of day with either a time zone offset or named zone.It cannot be used to store an interval of time. |
|
8 bytes |
From start of day 0001-01-01 AD to end of day 9999-12-31 AD |
Date and time of day |
|
10 bytes |
From start of day 0001-01-01 AD to end of day 9999-12-31 AD |
Date and time of day with either a time zone offset or named zone. |
|
n bytes |
from 1 to 32,765 bytes |
Variable length string type;synonym for |
|
n characters.Size in bytes depends on the encoding, the number of bytes in a character |
from 1 to 32,765 bytes |
Variable length string type.The total size of characters in bytes cannot be larger than (32KB-3), taking into account their encoding.The two leading bytes store the declared length.There is no default size: the n argument is mandatory.Leading and trailing spaces are stored, and they are not trimmed, except for those trailing characters that are past the declared length. |
Note
|
Note About Dates
Bear in mind that a time series consisting of dates in past centuries is processed without taking into account the actual historical facts, as though the Gregorian calendar were applicable throughout the entire series. |