Skip to content

[#10957] fix(catalog-postgresql): Map serial types to integer types in PostgreSqlTypeConverter#10970

Open
sachinnn99 wants to merge 1 commit into
apache:mainfrom
sachinnn99:fix/10957-postgresql-serial-type-mapping
Open

[#10957] fix(catalog-postgresql): Map serial types to integer types in PostgreSqlTypeConverter#10970
sachinnn99 wants to merge 1 commit into
apache:mainfrom
sachinnn99:fix/10957-postgresql-serial-type-mapping

Conversation

@sachinnn99
Copy link
Copy Markdown
Contributor

@sachinnn99 sachinnn99 commented May 5, 2026

What changes were proposed in this pull request?

Add type mappings for PostgreSQL's serial, smallserial, and bigserial type aliases (and their shorthand forms serial2, serial4, serial8) in PostgreSqlTypeConverter.toGravitino().

Why are the changes needed?

When the JDBC driver reports serial/smallserial/bigserial as the TYPE_NAME, the converter falls through to ExternalType.of("serial"). The Trino connector has no mapping for EXTERNAL types, causing queries to fail with:

Unsupported gravitino datatype: external(serial)

These types are aliases for int2/int4/int8 with an auto-increment sequence, so they should map to ShortType/IntegerType/LongType respectively.

Fixes #10957

Does this PR introduce any user-facing change?

No API changes. PostgreSQL tables with serial columns can now be queried through Trino without errors.

How was this patch tested?

Added unit test assertions for all 6 serial type variants in TestPostgreSqlTypeConverter.testToGravitinoType().

…ypes in PostgreSqlTypeConverter

PostgreSQL serial/smallserial/bigserial types were falling through to
ExternalType, causing Trino queries to fail with "Unsupported gravitino
datatype: external(serial)".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Improvement] Unsupported Gravitino datatype: external(serial) when querying via Trino

1 participant