Cheat Sheet Data Type Postgresql
Cheat Sheet Data Type Postgresql
www.databasestar.com
Numeric Character
BIGINT A large integer number CHARACTER (n) A fixed-length string, padded to a length of “n” characters.
Range -9,223,372,036,854,775,808 to Range: Up to 10,485,760 characters (1GB)
+9,223,372,036,854,775,807
A decimal number with precision. CHAR (n) A fixed-length string, padded to a length of “n” characters.
DECIMAL
Range: up to 131,072 digits before the decimal point; up to Range: Up to 10,485,760 characters (1GB)
16,383 digits after the decimal point
TEXT A variable length string
NUMERIC (p, s) A decimal number with precision of “p” and scale of “s”
Range: up to 131,072 digits before the decimal point; up to BYTEA A variable-length binary string. Similar to BLOB
16,383 digits after the decimal point
ENUM A set of values that can be used for a column.
REAL A floating-point variable-precision number. 6 decimal digits
precision
JSON Stores JSON data
DOUBLE A floating-point variable-precision number. 15 decimal digits
PRECISION precision JSONB Stores JSON data in binary format, and can support
indexing.
SMALLSERIAL A small automatically incrementing integer.
Range: 1 to 32,767
TIMESTAMP (p) A date and time value with time zone. Precision “p” can be CIDR Stores IPv4 and IPv6 network addresses
WITH TIME ZONE specified which is the number of fractional seconds.
Range: 4713 BC to 294276 AD
INET Stores IPv4 and IPv6 hosts and network addresses
DATE A date but no time.
Range: 4713 BC to 5874897 AD MACADDR Stores MAC addresses using 6 bytes.
TIME (p) A time of day with no date Precision “p” can be specified
MACADDR8 Stores MAC addresses using 8 bytes (the EUI-64 format)
which is the number of fractional seconds.
Range: 00:00:00 to 24:00:00
TSVECTOR A sorted list of words
TIME (p) WITH A time of day with no date and a time zone Precision “p” can be
TIME ZONE specified which is the number of fractional seconds. TSQUERY A list of words to be searched for
Range: 00:00:00+1459 to 24:00:00-1459