If the table has an auto incrementing primary key insertId will hold
the generated id on dialects that support it. For example PostgreSQL doesn't
return the id by default and insertId is undefined. On PostgreSQL you
need to use returning or returningAll
to get out the inserted id.
numInsertedOrUpdatedRows holds the number of (actually) inserted rows.
On MySQL, updated rows are counted twice when using on duplicate key update.
The result of an insert query.
If the table has an auto incrementing primary key insertId will hold the generated id on dialects that support it. For example PostgreSQL doesn't return the id by default and insertId is undefined. On PostgreSQL you need to use returning or returningAll to get out the inserted id.
numInsertedOrUpdatedRows holds the number of (actually) inserted rows. On MySQL, updated rows are counted twice when using
on duplicate key update
.Examples