PostgreSQL Datatypes
Following are a few common data types one can use in PostgreSQL:
- Character datatypes:
- Char(n): fixed-length strings, blank padded in case string length is less than n.
- Varchar(n): variable length strings but within a certain limit.
- Text: string values with no length constraint, i.e unlimited length allowed.
- Numeric datatypes:
- Integers:
- small int (2 bytes)
- integer (4 bytes)
- big int (8 bytes)
- Floating-point numbers:
- decimal (variable)
- numeric (variable)
- real (4 bytes)
- double (8 bytes)
- Integers:
- Boolean:
- True
- False
- Null
- XML datatype: to store XML data.
- JSON datatype: to store JSON data.
- Geometric datatype:
- Point
- Line
- Lseg (finite line segment)
- Box
- Path
- Polygon
- Circle
- Date time datatypes:
- Timestamp without timezone
- Timestamp with timezone
- Date
- Time without timezone
- Time with timezone
- Interval
1
