Databases
PostgreSQL
Column Types

PostgreSQL Column Types

SchemaHero supports the following PostgreSQL column types. If a type is missing, open an issue (opens in a new tab).

Simple Types

These types are used without parameters:

TypeAliasesDescription
bigintint88-byte signed integer
bigserialserial8Auto-incrementing 8-byte integer
booleanboolTrue/false value
boxRectangular box on a plane
byteaBinary data
cidrIPv4 or IPv6 network address
circleCircle on a plane
citextCase-insensitive text
dateCalendar date
double precisionfloat88-byte floating point
inetIPv4 or IPv6 host address
integerint, int44-byte signed integer
jsonJSON data
jsonbBinary JSON data (indexable)
lineInfinite line on a plane
lsegLine segment on a plane
macaddrMAC address
moneyCurrency amount
pathGeometric path on a plane
pg_lsnPostgreSQL Log Sequence Number
pointGeometric point on a plane
polygonClosed geometric path on a plane
realfloat44-byte floating point
smallintint22-byte signed integer
smallserialserial2Auto-incrementing 2-byte integer
serialserial4Auto-incrementing 4-byte integer
textVariable-length character string
tsqueryText search query
tsvectorText search document
txid_snapshotTransaction ID snapshot
uuidUniversally unique identifier
xmlXML data

Parameterized Types

These types accept length, precision, or scale parameters:

TypeExampleDescription
bit(n)bit(8)Fixed-length bit string
bit varying(n)bit varying(64), varbit(64)Variable-length bit string
character(n)character(10), char(10)Fixed-length character string
character varying(n)character varying(255), varchar(255)Variable-length character string
numeric(p,s)numeric(10,2), decimal(10,2)Exact numeric with precision and scale
numeric(p)numeric(10)Exact numeric with precision
time(p)time(6)Time of day with precision
time with time zonetimetzTime with timezone
time(p) with time zonetime(6) with time zoneTime with timezone and precision
time without time zoneTime without timezone (default)
timestamp(p)timestamp(6)Date and time with precision
timestamp with time zonetimestamptzTimestamp with timezone
timestamp(p) with time zonetimestamp(6) with time zoneTimestamp with timezone and precision
timestamp without time zoneTimestamp without timezone (default)
vector(n)vector(1536)pgvector extension for embeddings

Array Types

Any type can be made into an array by appending []:

columns:
  - name: tags
    type: text[]
  - name: scores
    type: integer[]
  - name: matrix
    type: double precision[]

Type Aliases

SchemaHero automatically normalizes these aliases:

You WriteSchemaHero Uses
int8bigint
serial8bigserial
boolboolean
float8double precision
int, int4integer
float4real
int2smallint
serial2smallserial
serial4serial
varbitbit varying
charcharacter
varcharcharacter varying
decimalnumeric
timetztime with time zone
timestamptztimestamp with time zone

Examples

columns:
  - name: id
    type: bigserial
  - name: uuid
    type: uuid
  - name: email
    type: varchar(255)
  - name: price
    type: numeric(10,2)
  - name: active
    type: boolean
  - name: metadata
    type: jsonb
  - name: tags
    type: text[]
  - name: created_at
    type: timestamptz
  - name: embedding
    type: vector(1536)