ORACLE
ORACLE
DTDrizzle Team
Created by ORACLE on 3/13/2025 in #help
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/[email protected][email protected]/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/[email protected][email protected]/node_modules/pg-pool/index.js:45:11
at processTicksAndRejections (node:internal/process/task_queues:105:5)
can anyone help me?
13 replies