Sign up for Hasura Newsletter
Loading...

Data Types and Columns

Data types restrict the kind of data that can be stored for each column.

PostgreSQL natively supports a rich set of data types. Users can also extend it by adding customised types using CREATE TYPE command.

We will now look at the list of native types that are supported:

Numeric Types

Integers

  • integer
  • smallint
  • bigint

Serials

  • serial
  • smallserial
  • bigserial

Arbitrary precision

  • numeric

Floating point types

  • real
  • double precision

Character Types

  • character varying(n) / varchar(n)
  • character(n)
  • text

Boolean Type

  • boolean with state of true/false

Date Time Types

  • date
  • time
  • timestamp
  • interval

UUID Type

Universally Unique Identifiers are 128-bit numbers used to uniquely identify a piece of information and typically in database context it is used to identify a row.

Geometric Types

  • point
  • line
  • box
  • path
  • lseg
  • polygon
  • circle

JSON Types

  • json
  • jsonb (binary form for faster execution)

There are more such supported types including monetary for money related, binary types for raw byte storage, network address types for IP address references, arrays etc. You can read more about all available PostgreSQL Data Types from their official docs.

Did you find this page helpful?
Start with GraphQL on Hasura for Free
  • ArrowBuild apps and APIs 10x faster
  • ArrowBuilt-in authorization and caching
  • Arrow8x more performant than hand-rolled APIs
Promo
footer illustration
Brand logo
© 2024 Hasura Inc. All rights reserved
Github
Titter
Discord
Facebook
Instagram
Youtube
Linkedin