Skip to content

D1 adaptor throws "Conversion failed: expected a datetime string in column" when string column contains rfc3339 date #27143

@Yesterday17

Description

@Yesterday17

Bug description

This issue is a follow-up to #25404.

Pull Request #25483 attempted to address the original problem by adding start (^) and end ($) anchors to the isoDateRegex. However, this fix was not comprehensive and the underlying issue persists.

The isoDateRegex consists of three alternations (branches separated by |). The fix in PR #25483 correctly added the ^ anchor to the beginning of the first alternation and the $ anchor to the end of the last alternation.

Unfortunately, the middle alternation(s) were not properly anchored. This means that this unanchored branch can still incorrectly match a date-like substring within a larger string, rather than ensuring the entire string is a valid ISO date. This is the same behavior reported in the original issue #25404.

Severity

⚠️ Major: Breaks core functionality (e.g., migrations fail)

Reproduction

Expected vs. Actual Behavior

Expected behavior: String contains rfc3339 date(such as 2025-05-11T22:02:36+09:00) should not be treated as datetime.

Frequency

Consistently reproducible

Does this occur in development or production?

Both development and production

Is this a regression?

Workaround

Prisma Schema & Queries

// Add relevant schema.prisma snippet
// Add relevant Prisma Client query

Prisma Config

// Add your `prisma.config.ts`

Logs & Debug Info

// Debug logs here

Environment & Setup

  • OS:
  • Database:
  • Node.js version:

Prisma Version

// Prisma version output
prisma                  : 6.6.0
@prisma/client          : 6.6.0
Computed binaryTarget   : darwin-arm64
Operating System        : darwin
Architecture            : arm64
Node.js                 : v22.13.1
TypeScript              : 5.7.3
Query Engine (Node-API) : libquery-engine f676762280b54cd07c770017ed3711ddde35f37a (at ../../node_modules/.pnpm/@[email protected]/node_modules/@prisma/engines/libquery_engine-darwin-arm64.dylib.node)
Schema Engine           : schema-engine-cli f676762280b54cd07c770017ed3711ddde35f37a (at ../../node_modules/.pnpm/@[email protected]/node_modules/@prisma/engines/schema-engine-darwin-arm64)
Schema Wasm             : @prisma/prisma-schema-wasm 6.6.0-53.f676762280b54cd07c770017ed3711ddde35f37a
Default Engines Hash    : f676762280b54cd07c770017ed3711ddde35f37a
Studio                  : 0.511.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions