Skip to content

fix(adapter-pg,adapter-neon,adapter-ppg): support TIMETZ[] columns - #30148

Open
UgaTheDev wants to merge 1 commit into
prisma:v7from
UgaTheDev:fix/adapter-pg-timetz-array
Open

fix(adapter-pg,adapter-neon,adapter-ppg): support TIMETZ[] columns#30148
UgaTheDev wants to merge 1 commit into
prisma:v7from
UgaTheDev:fix/adapter-pg-timetz-array

Conversation

@UgaTheDev

@UgaTheDev UgaTheDev commented Aug 27, 2026

Copy link
Copy Markdown

Fixes #29397
Base branch: v7 (the Prisma 8 main tree no longer contains the adapter-* packages).

Problem

Any query touching a timetz[] column fails with a deserialization error surfaced as P2010:

Error in performing request: UnsupportedNativeDataType

Root cause (posted on #29397): in packages/adapter-pg/src/conversion.ts, the ArrayColumnType
map has no entry for TIMETZ_ARRAY (OID 1270), fieldToColumnType therefore has no case for it,
and no parser is registered for it. The OID is below FIRST_NORMAL_OBJECT_ID, so it is not treated
as a user type either and falls straight through to default:, which throws
UnsupportedNativeDataType. Scalar timetz (OID 1266) is handled; only the array form is missing.

adapter-neon and adapter-ppg carry copies of the same conversion table and have the identical
gap, so all three are fixed here.

Change

For each of the three adapters:

  1. TIMETZ_ARRAY: 1270 added to ArrayColumnType.
  2. fieldToColumnType maps it to ColumnTypeEnum.TimeArray, alongside TIME_ARRAY — matching how
    scalar TIMETZ already shares ColumnTypeEnum.Time with TIME.
  3. The array parser is registered as normalize_array(normalize_timez), i.e. the element
    normalizer is the existing scalar TIMETZ normalizer, used as-is.

Scope: array mapping only

This PR is deliberately "stop throwing" and nothing more.

normalize_timez strips the UTC offset from the value, which is the behavior discussed in #7915 /
#7917. That behavior is intentionally reused unchanged here, so timetz[] elements deserialize
byte-for-byte identically to a scalar timetz column on the same connection. Whatever the
maintainers decide about timetz offset semantics will then apply to scalars and arrays together,
with no separate array code path to remember. This PR does not preempt that decision.

Tests

  • packages/adapter-pg/src/__tests__/timetz-array.test.ts (new)
  • packages/adapter-neon/src/__tests__/timetz-array.test.ts (new)
  • packages/adapter-ppg/src/conversion.test.ts (new describe('TIMETZ[]') block, following the
    file's existing getParser(oid) pattern)

Each asserts that OID 1270 maps to TimeArray and that the registered parser normalizes elements
exactly like the scalar path ('{10:30:00+02,11:00:00-05:00,12:00:00}'
['10:30:00', '11:00:00', '12:00:00']).

Verified failing on v7 before the fix with UnsupportedNativeDataType, passing after. Full unit
suites for all three adapter packages are green (adapter-pg 57, adapter-neon 10, adapter-ppg
43 tests).

Not covered: an end-to-end driver-adapters integration test against a real timetz[] column,
since that would need a schema fixture in the functional test suite. Happy to add one if you'd
prefer the coverage there instead of / in addition to the unit level.

Summary by CodeRabbit

  • New Features

    • Added support for PostgreSQL TIMETZ[] columns across Neon, PostgreSQL, and PPG adapters.
    • TIMETZ[] values are now recognized as time arrays and normalized consistently with scalar TIMETZ values.
  • Tests

    • Added coverage verifying type detection and timezone-offset normalization for TIMETZ[] values.

Selecting a `timetz[]` column threw `UnsupportedNativeDataType` (surfaced as
P2010) because OID 1270 was missing from ArrayColumnType, had no case in
fieldToColumnType, and had no registered array parser, so it fell through to
the default branch.

Map OID 1270 to ColumnTypeEnum.TimeArray and register the array parser using
the same element normalizer as scalar TIMETZ, so array and scalar TIMETZ stay
byte-for-byte consistent. This does not change the offset semantics tracked in
 prisma#7915/prisma#7917.

Fixes prisma#29397

Signed-off-by: Kush Zingade <kush.zingade@gmail.com>
@CLAassistant

CLAassistant commented Aug 27, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@coderabbitai

coderabbitai Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 99a56813-89f0-4f99-b5ee-1f19cd12ef31

📥 Commits

Reviewing files that changed from the base of the PR and between 312e543 and 9bc4190.

📒 Files selected for processing (6)
  • packages/adapter-neon/src/__tests__/timetz-array.test.ts
  • packages/adapter-neon/src/conversion.ts
  • packages/adapter-pg/src/__tests__/timetz-array.test.ts
  • packages/adapter-pg/src/conversion.ts
  • packages/adapter-ppg/src/conversion.test.ts
  • packages/adapter-ppg/src/conversion.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The Neon, PostgreSQL, and PPG adapters now support PostgreSQL TIMETZ[] columns. OID 1270 maps to ColumnTypeEnum.TimeArray, and array elements use scalar TIMETZ normalization.

Changes

TIMETZ array adapter support

Layer / File(s) Summary
Neon TIMETZ array conversion and tests
packages/adapter-neon/src/conversion.ts, packages/adapter-neon/src/__tests__/timetz-array.test.ts
The Neon adapter recognizes OID 1270, maps it to TimeArray, strips timezone offsets from array elements, and tests both behaviors.
PostgreSQL TIMETZ array conversion and tests
packages/adapter-pg/src/conversion.ts, packages/adapter-pg/src/__tests__/timetz-array.test.ts
The PostgreSQL adapter recognizes OID 1270, maps it to TimeArray, strips timezone offsets from array elements, and tests both behaviors.
PPG TIMETZ array conversion and tests
packages/adapter-ppg/src/conversion.ts, packages/adapter-ppg/src/conversion.test.ts
The PPG adapter recognizes OID 1270, maps it to TimeArray, strips timezone offsets from array elements, and tests both behaviors.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 9bc41

This PR enables TIMETZ[] deserialization across the three adapters while preserving existing scalar timetz normalization; no actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers: aqrln, rtbenfield, sevinf

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 6 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the fix and names all three affected adapters. It accurately describes TIMETZ[] support.
Linked Issues check ✅ Passed The PR addresses the adapter conversion gap for PostgreSQL TIMETZ[] deserialization by adding OID 1270 mappings and parsers in all three adapters. The tests cover the required type mapping and normali…
Out of Scope Changes check ✅ Passed All changes support the linked issue. The conversion updates and adapter tests are directly related to TIMETZ[] deserialization in issue #29397.
Full details: Linked Issues check

Explanation

The PR addresses the adapter conversion gap for PostgreSQL TIMETZ[] deserialization by adding OID 1270 mappings and parsers in all three adapters. The tests cover the required type mapping and normalization behavior for issue #29397.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

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.

2 participants