Github   Telegram
No Matches
uPg: Supported data types

uPg provides data type support with a system of buffer parsers and formatters. Please refer to uPg: Parsers and Formatters for more information about the system.

See also
Postgres parsers and formatters
Fundamental PostgreSQL types

The fundamental PostgreSQL types support is provided by the driver. The table below shows supported Postgres types and their mapping to C++ types provided by the driver. Colum "Default" marks the Postgres type to which a C++ type is mapped when used as a parameter. Where the C++ type is N/A it means that the PosgreSQL data type is not supported. When there is a C++ type in parenthesis, it is a data type that will be supported later and the C++ type is planned counterpart.

PG type C++ type Default
smallint std::int16_t +
integer std::int32_t +
bigint std::int64_t +
smallserial std::int16_t
serial std::int32_t
bigserial std::int64_t
boolean bool +
real float +
double precision double +
numeric(p) decimal64::Decimal<P> +
decimal(p) decimal64::Decimal<P> +
money N/A
text std::string +
char(n) std::string
varchar(n) std::string
"char" char +
timestamp std::chrono::system_clock::time_point +
timestamptz storages::postgres::TimePointTz +
date utils::datetime::Date +
time utils::datetime::TimeOfDay<> +
timetz N/A
interval std::chrono::microseconds
bytea container of one-byte type
bit(n) N/A
bit varying(n) N/A
uuid boost::uuids::uuid +
json formats::json::Value
jsonb formats::json::Value +
int4range storages::postgres::IntegerRange
int8range storages::postgres::BigintRange
numrange N/A
tsrange N/A
tstzrange N/A
daterange N/A
The library doesn't provide support for C++ unsigned integral types intentionally as PostgreSQL doesn't provide unsigned types and using the types with the database is error-prone.

For more information on timestamps and working with time zones please see uPg timestamp support


The driver supports PostgreSQL arrays provided that the element type is supported by the driver. See uPg: Arrays for more information.

User-defined PostgreSQL types

The driver provides support for user-defined PostgreSQL types:

  • domains
  • enumerations
  • composite types

For more information please see uPg: Mapping a C++ type to PostgreSQL user type.

C++ strong typedefs

The driver provides support for C++ strong typedef idiom. For more information see uPg: support for C++ 'strong typedef' idiom

PostgreSQL ranges

PostgreSQL range type support is provided by storages::postgres::Range template.

Geometry types

For geometry types the driver provides parsing/formatting from/to on-the-wire representation. The types provided do not define any calculus.


See @pg_bytea

PostgreSQL types not covered above

The types not covered above or marked as N/A in the table of fundamental types will be eventually supported later, on request from the driver's users.