RefLib

Reference library for AI

Back

postgresql_16:3.5.1 Numeric Types

PostgreSQL 16 > The SQL Language > Data Types > Numeric Types

Numeric types consist of two-, four-, and eight-byte integers, four- and eight-byte floating-point numbers, and selectable-precision decimals. (see datatype-numeric-table) lists the available types.

| Name | Storage Size | Description | Range | | --- | --- | --- | --- | | smallint | 2 bytes | small-range integer | -32768 to +32767 | | integer | 4 bytes | typical choice for integer | -2147483648 to +2147483647 | | bigint | 8 bytes | large-range integer | -9223372036854775808 to +9223372036854775807 | | decimal | variable | user-specified precision, exact | up to 131072 digits before the decimal point; up to 16383 digits after the decimal point | | numeric | variable | user-specified precision, exact | up to 131072 digits before the decimal point; up to 16383 digits after the decimal point | | real | 4 bytes | variable-precision, inexact | 6 decimal digits precision | | double precision | 8 bytes | variable-precision, inexact | 15 decimal digits precision | | smallserial | 2 bytes | small autoincrementing integer | 1 to 32767 | | serial | 4 bytes | autoincrementing integer | 1 to 2147483647 | | bigserial | 8 bytes | large autoincrementing integer | 1 to 9223372036854775807 |

The syntax of constants for the numeric types is described in (see postgresql_16:3.1.1.2). The numeric types have a full set of corresponding arithmetic operators and functions. Refer to (see postgresql_16:3.6) for more information. The following sections describe the types in detail.

Subsections

Back