Dup Ver Goto 📝

Postgresql Data Types

PT2/db/postgres psql does not exist
To
54 lines, 279 words, 2286 chars Page 'Postgres_Data_Types' does not exist.

Postgresql Data Types

These are not all the types available. Rather this is a list of ones that gets amended as I need them. See the official docs for something more comprehensive.

Common

TypeDescription
integer4 bytes, aka int32
bigint8 bytes, aka int64
real4 bytes, aka float
double precision8 bytes, aka double
serial4 bytes, autoincrementing int32
bigserial8 bytes, autoincrementing int64

Numeric

NameStorage SizeDescriptionRange
smallint2 bytessmall-range integer-32768 to +32767
integer4 bytestypical choice for integer-2147483648 to +2147483647
bigint8 byteslarge-range integer-9223372036854775808 to +9223372036854775807
decimalvariableuser-specified precision, exactup to 131072 digits before the decimal point; up to 16383 digits after the decimal point
numericvariableuser-specified precision, exactup to 131072 digits before the decimal point; up to 16383 digits after the decimal point
real4 bytesvariable-precision, inexact6 decimal digits precision
double precision8 bytesvariable-precision, inexact15 decimal digits precision
smallserial2 bytessmall autoincrementing integer1 to 32767
serial4 bytesautoincrementing integer1 to 2147483647
bigserial8 byteslarge autoincrementing integer1 to 9223372036854775807
numeric(precision, scale)?Arbitrary Precision

Date/Time

NameStorage SizeDescriptionLow ValueHigh ValueResolution
timestamp [ (p) ] [ without time zone ]8 bytesboth date and time (no time zone)4713 BC294276 AD1 microsecond
timestamp [ (p) ] with time zone8 bytesboth date and time, with time zone4713 BC294276 AD1 microsecond
date4 bytesdate (no time of day)4713 BC5874897 AD1 day
time [ (p) ] [ without time zone ]8 bytestime of day (no date)00:00:0024:00:001 microsecond
time [ (p) ] with time zone12 bytestime of day (no date), with time zone00:00:00+155924:00:00-15591 microsecond
interval [ fields ] [ (p) ]16 bytestime interval-178000000 years178000000 years1 microsecond

Notes:

Dummy Template

TypeDescription