Типы данных в PostgresSQL
Следуя по официально документации, можно найти основные типы данных, встроенные в PostgreSQL по умолчанию.
ВАЖНО можно также создавать свои типы данных при помощи CREATE TYPE команды.
Таблица №1. Типы данных в PostgreSQL
Name |
Aliases |
Description |
|---|---|---|
bigint |
|
signed eight-byte integer |
bigserial |
|
autoincrementing eight-byte integer |
bit [ (n) ] |
fixed-length bit string |
|
bit varying [ (n) ] |
|
variable-length bit string |
boolean |
|
logical Boolean (true/false) |
box |
rectangular box on a plane |
|
bytea |
binary data (“byte array”) |
|
character [ (n) ] |
|
fixed-length character string |
character varying [ (n) ] |
|
variable-length character string |
cidr |
IPv4 or IPv6 network address |
|
circle |
circle on a plane |
|
date |
calendar date (year, month, day) |
|
double precision |
|
double precision floating-point number (8 bytes) |
inet |
IPv4 or IPv6 host address |
|
integer |
|
signed four-byte integer |
interval [ fields ] [ (p) ] |
time span |
|
json |
textual JSON data |
|
jsonb |
binary JSON data, decomposed |
|
line |
infinite line on a plane |
|
lseg |
line segment on a plane |
|
macaddr |
MAC (Media Access Control) address |
|
macaddr8 |
MAC (Media Access Control) address (EUI-64 format) |
|
money |
currency amount |
|
numeric [ (p, s) ] |
|
exact numeric of selectable precision |
path |
geometric path on a plane |
|
pg_lsn |
PostgreSQL Log Sequence Number |
|
pg_snapshot |
user-level transaction ID snapshot |
|
point |
geometric point on a plane |
|
polygon |
closed geometric path on a plane |
|
real |
|
single precision floating-point number (4 bytes) |
smallint |
|
signed two-byte integer |
smallserial |
|
autoincrementing two-byte integer |
serial |
|
autoincrementing four-byte integer |
text |
variable-length character string |
|
time [ (p) ] [ without time zone ] |
time of day (no time zone) |
|
time [ (p) ] with time zone |
|
time of day, including time zone |
timestamp [ (p) ] [ without time zone ] |
date and time (no time zone) |
|
timestamp [ (p) ] with time zone |
|
date and time, including time zone |
tsquery |
text search query |
|
tsvector |
text search document |
|
txid_snapshot |
user-level transaction ID snapshot (deprecated; see pg_snapshot) |
|
uuid |
universally unique identifier |
|
xml |
XML data |