Skip to content

Filter out undefined values in INSERT queries #25829

@alii

Description

@alii

@cirospaciari This is still a problem for me in Bun 1.3.5. The following code:

const [record] = await sql`
	INSERT INTO "MyTable" ${sql({
		foo: undefined,
		id: Bun.randomUUIDv7()
	})}
`;

Results in this error:

null value in column \"foo\" of relation \"MyTable\" violates not-null constraint

Any chance your fix could also be ported over support INSERT statements?

Originally posted by @EvHaus in #22156

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingsqlSomething to do with `sql` in the "bun" module (postgres, sqlite & mysql)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions