Skip to content

drizzle push does not work #2016

@miles-kt-inkeep

Description

@miles-kt-inkeep

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)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions