ยฉ 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Teamโ€ข11mo agoโ€ข
12 replies
ORACLE

cannot insert into column "id"

i get this error when i try to insert more than one value into my postgres

export const productsTable = pgTable("products", {
  id: integer().primaryKey().generatedAlwaysAsIdentity({ startWith: 1000 }),
  name: varchar({ length: 255 }).notNull(),
})

const result = await db
  .insert(productsTable)
  .values([
    { name: 'test' },
    { name: 'test2' },
  ])
export const productsTable = pgTable("products", {
  id: integer().primaryKey().generatedAlwaysAsIdentity({ startWith: 1000 }),
  name: varchar({ length: 255 }).notNull(),
})

const result = await db
  .insert(productsTable)
  .values([
    { name: 'test' },
    { name: 'test2' },
  ])



error: cannot insert into column "id"
    at .../node_modules/.pnpm/pg-pool@3.8.0_pg@8.14.0/node_modules/pg-pool/index.js:45:11
    at processTicksAndRejections (node:internal/process/task_queues:105:5)
error: cannot insert into column "id"
    at .../node_modules/.pnpm/pg-pool@3.8.0_pg@8.14.0/node_modules/pg-pool/index.js:45:11
    at processTicksAndRejections (node:internal/process/task_queues:105:5)


can anyone help me?
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Cant insert integer into column of type json number array
Drizzle TeamDTDrizzle Team / help
2y ago
Dynamic column name and insert
Drizzle TeamDTDrizzle Team / help
2y ago
Drizzle rename id column
Drizzle TeamDTDrizzle Team / help
3y ago
error: column "id" cannot be cast automatically to type uuid
Drizzle TeamDTDrizzle Team / help
3y ago