

# Data type mapping for integrations with Amazon S3 Tables

**Important**  
This is preview documentation for the Aurora PostgreSQL integration with Amazon S3 Tables. Before using this capability, review the Betas and Previews terms in the [AWS Service Terms](https://aws.amazon.com/service-terms/).

When the Aurora PostgreSQL integration with Amazon S3 Tables replicates a table, each PostgreSQL column type maps to an Apache Iceberg type in the target table.

**Topics**
+ [Direct type mappings](#s3tables-integration.data-type-mapping.direct)
+ [Transformed type mappings](#s3tables-integration.data-type-mapping.transformed)
+ [Text, binary, JSON, and array types](#s3tables-integration.data-type-mapping.text-binary-json-array)
+ [Generated, default, and identity columns](#s3tables-integration.data-type-mapping.generated)
+ [Unsupported types and values](#s3tables-integration.data-type-mapping.unsupported)

## Direct type mappings
<a name="s3tables-integration.data-type-mapping.direct"></a>

The following PostgreSQL types map directly to an Iceberg type.


| PostgreSQL type | Iceberg type | 
| --- | --- | 
| BIGINT | long | 
| BOOLEAN | boolean | 
| DATE | date | 
| DOUBLE PRECISION | double | 
| INTEGER | int | 
| NAME | string | 
| NUMERIC(p, s) | decimal(p, s) | 
| REAL | float | 
| SMALLINT | int | 
| TIME | string | 
| TIMETZ | string | 
| TIMESTAMP | timestamp | 
| TIMESTAMPTZ | timestamptz | 
| UUID | string | 
| SMALLSERIAL, SERIAL | int | 
| BIGSERIAL | long | 

## Transformed type mappings
<a name="s3tables-integration.data-type-mapping.transformed"></a>

The following types are converted to an Iceberg type that can represent them.


| PostgreSQL type | Iceberg type | 
| --- | --- | 
| CID, OID, XID | long | 
| XID8 | decimal(20, 0) | 
| CIDR, INET, MACADDR, MACADDR8, PG\_LSN | string | 
| MONEY | decimal(20, 3) | 
| INTERVAL | string | 

## Text, binary, JSON, and array types
<a name="s3tables-integration.data-type-mapping.text-binary-json-array"></a>

The following table lists the Iceberg types for text, binary, JSON, and array types. JSON values and arrays are stored as JSON text in Iceberg string columns.


| PostgreSQL type | Iceberg type | 
| --- | --- | 
| TEXT, VARCHAR, CHAR, BPCHAR | string | 
| BYTEA | binary | 
| BIT(n) | binary | 
| BIT VARYING | binary | 
| JSON, JSONB | string | 
| JSONPATH, TSQUERY, XML, PG\_SNAPSHOT | string | 
| TSVECTOR | string | 
| INT2VECTOR | string | 
| OIDVECTOR | string | 
| Arrays of any supported element type, of any dimension, such as INTEGER[] or TEXT[] | string (the array as JSON text, for example [1,2,3]) | 

If a table has an array of an unsupported element type, replication of the table fails. A `NUMERIC` array replicates as a string even if its element type has no precision or scale or exceeds the limits listed in [Unsupported types and values](#s3tables-integration.data-type-mapping.unsupported). Those limits apply only to scalar `NUMERIC` columns. As a primary key column, an array of `JSONB`, `BIT VARYING`, `TIMESTAMPTZ`, `INT2VECTOR`, or `OIDVECTOR` is not supported.

## Generated, default, and identity columns
<a name="s3tables-integration.data-type-mapping.generated"></a>

The integration replicates the values stored in the following columns. The target column has the Iceberg type that matches the source column's base type, for example `int` for a `SERIAL` column. The target column does not include the source column's generation expression or default value.
+ Stored generated columns (`GENERATED ALWAYS AS ... STORED`).
+ Columns with a `DEFAULT`.
+ Identity columns (`GENERATED ALWAYS AS IDENTITY` or `GENERATED BY DEFAULT AS IDENTITY`).
+ `SMALLSERIAL`, `SERIAL`, and `BIGSERIAL` columns.

If you add a generated, default, identity, or serial column to an existing source table, the integration resyncs the table so that existing rows in the target table get the values that PostgreSQL stored for that column. For more information, see [Changes that cause a resync](s3tables-integration.schema-changes.md#s3tables-integration.schema-changes.resync).

A generated column that evaluates to NULL replicates as NULL. An explicit NULL in a column with a `DEFAULT` stays NULL and is not replaced by the default.

## Unsupported types and values
<a name="s3tables-integration.data-type-mapping.unsupported"></a>

If a table has a column of one of the following types, the integration does not replicate the table. Instead, the table enters the `FAILED` state, its `status_reason` is `SOURCE_UNSUPPORTED_TYPE`, and its `status_detail` names the column and its type. For user-defined types, such as enums, domains, and composite types, `status_detail` shows the type as `USER-DEFINED`. To avoid the failure, exclude the column with a data rule. The unsupported types are the following:
+ `NUMERIC` with no precision or scale, with precision greater than 38, with a scale larger than its precision, or with a negative scale.
+ Composite types and other user-defined types.
+ `HSTORE`.
+ Range types, such as `INT4RANGE` and `NUMRANGE`, and multirange types, such as `INT4MULTIRANGE`.
+ Geometry and geography types, such as `POINT`, `LINE`, `LSEG`, `BOX`, `PATH`, `POLYGON`, `CIRCLE`, and PostGIS types.

To replicate the table, exclude the column with a data rule or change its type at the source, and then resync the table. For more information, see [Data rules for integrations with Amazon S3 Tables](s3tables-integration.data-rules.md) and [Resyncing integrations with Amazon S3 Tables](s3tables-integration.resyncing.md).

If a row holds a value that the integration cannot represent, the table enters the `FAILED` state with the reason `SOURCE_UNSUPPORTED_VALUE`. This includes the following values of otherwise supported types:
+ NaN, Infinity, and -Infinity in a `NUMERIC` column.
+ `infinity` and `-infinity` in a `DATE`, `TIMESTAMP`, or `TIMESTAMPTZ` column.
+ Dates and timestamps in the BC era, for example `0001-01-01 BC`, in a `DATE`, `TIMESTAMP`, or `TIMESTAMPTZ` column.

To replicate the table, correct the value at the source, and then resync the table. NaN, Infinity, and -Infinity in `REAL` and `DOUBLE PRECISION` columns are supported. They replicate as the matching special values of the Iceberg `float` and `double` types.

For a list of all `status_reason` values and how to resolve each one, see [Per-table status](s3tables-integration.monitoring.md#s3tables-integration.monitoring.per-table-status).