PostgreSQL Datatypes

PostgreSQL supports the following data types:-

1. Boolean
2. Character types such as char, varchar and text
3. Numeric types such as integer and floating point number
4. Temporal types such as date, time, timestamp and interval
5. Array for storing array strings, numbers etc.


PostgreSQL Datatypes :

Boolean Datatypes :

Name Description Storage
Boolean It can hold 3 values: True, False or Null 1 bytes


Character Datatypes :

Name Description
character varying(n), varchar(n) It's variable length with limit
character(n), char(n) It's fixed length
text It's variable length with Unlimited length


Integer Datatypes :

Name Description Storage Range
Integer It's store the whole number 4 bytes -2147483648 to +2147483647
Numeric It's store the floating point number Vaiable up to 131072 digits before the decimal point; up to 16383 digits after the decimal point
Serial It's 4 bytes 1 to 2147483647
real It's variable-precision,inexact 4 bytes 6 decimal digits precision
double precision It's variable-precision,inexact 8 bytes 15 decimal digits precision


Date/Time Datatypes :

Name Description Storage Low Value High Value Resolution
time [ (p)] with time zone times of the day only; with time zone 12 bytes 00:00:00+1459 24:00:00-1459 1 ms/14 digit
time [ (p)] without time zone times of the day only; without time zone 8 bytes 00:00:00 24:00:00 1 ms/14 digit
date Date(no time a day) 4 bytes 4713 BC 5874897 AD 1 day
timestamp [(p)] [with time zone ] Both time and date with time zone 8 bytes 4713 BC 294276 AD 1 ms/14 digit
timestamp [(p)] [without time zone ] Both time and date without time zone 8 bytes 4713 BC 294276 AD 1 ms/14 digit
interval [fields ] [(p) ] time interval 12 bytes -178000000 years 178000000 years 1 ms/14 digit





Visit :


Discussion


* You must be logged in to add comment.