Skip to content

adapter-mariadb select json field fail #28143

Closed

Description

@seralo

Bug description

When using JSON fields from $queryRawUnsafe an error is returned:
"Unsupported column type: LONG_BLOB"
or
"Cannot serialize value of type object as Bytes"

Severity

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

Reproduction

schema extract

model test_json {
id Int @id @default(autoincrement()) @db.UnsignedInt
data Json? @db.Json
}

fill a row with json data

Code

prisma.$queryRawUnsafe("SELECT data FROM test_json")

Expected vs. Actual Behavior

return rows with json field as text (like with rust engine) (or json object).

Frequency

Consistently reproducible

Does this occur in development or production?

Only in development (e.g., CLI tools, migrations, Prisma Studio)

Is this a regression?

Works with rust engine.
Breaks with client engine and PrismaMariaDb adapter.

Workaround

Keep rust engine.

Prisma Schema & Queries

model test_json {
  id         Int       @id @default(autoincrement()) @db.UnsignedInt
  data    Json?     @db.Json
}
prisma.$queryRawUnsafe("SELECT data FROM test_json")
//With full table creation and insert:
await db.$executeRaw`DROP TABLE IF EXISTS _test_json`;
await db.$executeRaw`CREATE TABLE _test_json(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,data JSON DEFAULT NULL);`;
await db.$executeRaw`INSERT INTO _test_json(data) VALUES ('{"long":"0123456789"}'),('{"long":"0123456789"}');`;
const testJson=await db.$queryRaw`SELECT id, data FROM _test_json`;

Prisma Config

// Add your `prisma.config.ts`

Logs & Debug Info

prisma:query DROP TABLE IF EXISTS _test_json
prisma:query CREATE TABLE _test_json(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,data JSON DEFAULT NULL);
prisma:query INSERT INTO _test_json(data) VALUES ('{"long":"0123456789"}'),('{"long":"0123456789"}');
prisma:query SELECT id, data FROM _test_json
prisma:error Cannot serialize value of type object as Bytes

Environment & Setup

  • Database: MariaDB

Prisma Version

// Prisma version output

[email protected]

Activity

  1. added
    kind/bug
    on Sep 20, 2025
  2. added
    bug/1-unconfirmed
    topic: Json
    on Sep 29, 2025
  3. added
    tracked
    on Sep 30, 2025
  4. FGoessler commented on Sep 30, 2025

    @FGoessler
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug/1-unconfirmedkind/bugtopic: @prisma/adapter-mariadbtopic: Jsontopic: driverAdapterstopic: mariadbtopic: mysqltracked

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions