PostgreSQL Datatypes

Following are a few common data types one can use in PostgreSQL:

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

1

0