Skip to main content
All data types supported by OmniQL and their database mappings.

Type Mappings

OmniQLPostgreSQLMySQLMongoDB
AUTOSERIALINT AUTO_INCREMENTObjectId
BIGAUTOBIGSERIALBIGINT AUTO_INCREMENTObjectId
INTINTEGERINTInt32
BIGINTBIGINTBIGINTInt64
SMALLINTSMALLINTSMALLINTInt32
DECIMALDECIMALDECIMALDecimal128
NUMERICNUMERICDECIMALDecimal128
FLOATDOUBLE PRECISIONDOUBLEDouble
REALREALFLOATDouble
STRINGVARCHARVARCHAR(255)String
TEXTTEXTTEXTString
CHARCHARCHARString
BOOLEANBOOLEANBOOLEANBoolean
BOOLBOOLEANBOOLEANBoolean
TIMESTAMPTIMESTAMPTIMESTAMPDate
DATETIMETIMESTAMPDATETIMEDate
DATEDATEDATEDate
TIMETIMETIMEString
JSONJSONJSONObject
JSONBJSONBJSONObject
UUIDUUIDCHAR(36)UUID
BINARYBYTEABLOBBinData
BLOBBYTEABLOBBinData

Numeric Types

AUTO

Auto-incrementing primary key.
:CREATE TABLE User WITH id:AUTO, name:STRING
DatabaseOutput
PostgreSQLCREATE TABLE users (id SERIAL PRIMARY KEY, name VARCHAR)
MySQLCREATE TABLE users (id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255))

BIGAUTO

Auto-incrementing for large tables.
:CREATE TABLE Event WITH id:BIGAUTO, name:STRING
DatabaseOutput
PostgreSQLid BIGSERIAL PRIMARY KEY
MySQLid BIGINT AUTO_INCREMENT PRIMARY KEY

INT

Standard integer (-2,147,483,648 to 2,147,483,647).
:CREATE TABLE Product WITH id:AUTO, quantity:INT

BIGINT

Large integer for big numbers.
:CREATE TABLE Analytics WITH id:AUTO, views:BIGINT

SMALLINT

Small integer (-32,768 to 32,767).
:CREATE TABLE Rating WITH id:AUTO, score:SMALLINT

DECIMAL / NUMERIC

Exact numeric with precision.
:CREATE TABLE Product WITH id:AUTO, price:DECIMAL
:CREATE TABLE Product WITH id:AUTO, price:DECIMAL(10,2)
DatabaseOutput
PostgreSQLprice DECIMAL(10,2)
MySQLprice DECIMAL(10,2)

FLOAT

Double-precision floating point.
:CREATE TABLE Sensor WITH id:AUTO, temperature:FLOAT
DatabaseOutput
PostgreSQLtemperature DOUBLE PRECISION
MySQLtemperature DOUBLE

REAL

Single-precision floating point.
:CREATE TABLE Measurement WITH id:AUTO, value:REAL
DatabaseOutput
PostgreSQLvalue REAL
MySQLvalue FLOAT

String Types

STRING

Variable-length string.
:CREATE TABLE User WITH id:AUTO, name:STRING
:CREATE TABLE User WITH id:AUTO, name:STRING(100)
DatabaseOutput
PostgreSQLname VARCHAR or name VARCHAR(100)
MySQLname VARCHAR(255) or name VARCHAR(100)

TEXT

Unlimited length text.
:CREATE TABLE Post WITH id:AUTO, content:TEXT

CHAR

Fixed-length string.
:CREATE TABLE Country WITH code:CHAR(2), name:STRING

Boolean Types

BOOLEAN / BOOL

True or false values.
:CREATE TABLE User WITH id:AUTO, active:BOOLEAN
:CREATE TABLE User WITH id:AUTO, verified:BOOL
DatabaseOutput
PostgreSQLactive BOOLEAN
MySQLactive BOOLEAN
MongoDBBoolean

Boolean in Queries

:GET User WHERE active = true
:GET User WHERE verified = false
:UPDATE User SET active = true WHERE id = 1

Date and Time Types

TIMESTAMP

Date and time.
:CREATE TABLE User WITH id:AUTO, created_at:TIMESTAMP
DatabaseOutput
PostgreSQLcreated_at TIMESTAMP
MySQLcreated_at TIMESTAMP
MongoDBDate

DATETIME

Date and time (MySQL uses DATETIME, PostgreSQL uses TIMESTAMP).
:CREATE TABLE Event WITH id:AUTO, event_time:DATETIME
DatabaseOutput
PostgreSQLevent_time TIMESTAMP
MySQLevent_time DATETIME

DATE

Date only (no time).
:CREATE TABLE Event WITH id:AUTO, event_date:DATE

TIME

Time only (no date).
:CREATE TABLE Schedule WITH id:AUTO, start_time:TIME

Date Literals in Queries

:GET Order WHERE created_at > "2024-01-01"
:GET Order WHERE created_at BETWEEN "2024-01-01" AND "2024-12-31"

JSON Types

JSON

Standard JSON data.
:CREATE TABLE User WITH id:AUTO, metadata:JSON
DatabaseOutput
PostgreSQLmetadata JSON
MySQLmetadata JSON
MongoDBObject (native)

JSONB

PostgreSQL optimized binary JSON.
:CREATE TABLE User WITH id:AUTO, metadata:JSONB
DatabaseOutput
PostgreSQLmetadata JSONB
MySQLmetadata JSON

UUID Type

Universally unique identifier.
:CREATE TABLE User WITH id:UUID, name:STRING
DatabaseOutput
PostgreSQLid UUID
MySQLid CHAR(36)
MongoDBUUID

UUID in Queries

:GET User WHERE id = "550e8400-e29b-41d4-a716-446655440000"

Binary Types

BINARY / BLOB

Binary data (files, images).
:CREATE TABLE File WITH id:AUTO, content:BINARY
:CREATE TABLE Image WITH id:AUTO, data:BLOB
DatabaseOutput
PostgreSQLcontent BYTEA
MySQLcontent BLOB
MongoDBBinData

Type with Constraints

Use colons to add constraints after the type:
:CREATE TABLE User WITH
  id:AUTO,
  email:STRING:NOTNULL:UNIQUE,
  name:STRING:NOTNULL,
  role:STRING
ConstraintSyntaxEffect
Not Null:NOTNULLColumn cannot be NULL
Unique:UNIQUEValues must be unique
Primary Key:PRIMARYKEYColumn is primary key
See Advanced Schema for more on constraints.

Type with Size

Specify size in parentheses:
:CREATE TABLE User WITH
  id:AUTO,
  name:STRING(100),
  code:CHAR(2),
  price:DECIMAL(10,2)

Limitations

Not currently supported:
  • DEFAULT values
  • CHECK constraints
  • Array types
  • Type casting
For these features, use native SQL.

Next Steps