-
-
Notifications
You must be signed in to change notification settings - Fork 39
Open
Labels
Description
I am working on a Typescipt application using Doltgres and Drizzle. When inserting a row with an explicit NULL value in a JSONB column using Drizzle ORM and the Node.js pg driver, I get the error cannot scan NULL into *string. The same operation works successfully with a Postgres db.
Environment:
- doltgres: 0.53.0
- drizzle-orm: 0.44.7
- pg: 8.16.3
Schema
import { jsonb, pgTable, text } from 'drizzle-orm/pg-core';
export const components = pgTable(
'components',
{
id: text('id').notNull(),
name: text('name'),
description: text('description'),
render: jsonb('render'),
}
);
SQL:
CREATE TABLE "data_components" (
"id" varchar(256) NOT NULL,
"name" varchar(256) NOT NULL,
"description" text NOT NULL,
"render" jsonb,
);
Example
import { Pool } from 'pg';
import { drizzle } from 'drizzle-orm/node-postgres';
const params = {
id: 'test',
render: null,
name: 'Test',
description: test,
};
const pool = new Pool({ connectionString });
const db = drizzle(pool, { schema });
await db
.insert(components)
.values(params)
The insert fails with the following error:
cause: error: cannot scan NULL into *string
at node_modules/.pnpm/[email protected][email protected]/node_modules/pg-pool/index.js:45:11
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)