Skip to content

bulkCreate + options.returning on a table with hasTrigger enabled does not work #7075

Description

@iamjoyce

What you are doing?

var Task = sequelize.define('task', {
    title: Sequelize.STRING,
    rating: { type: Sequelize.STRING, defaultValue: 3 }
}, {
    hasTrigger: true
});

Task.bulkCreate([{
    title: "Fix bug",
    rating: "5"
}, {
    title: "Write documentation",
    rating: "1"
}], {
    returning: true
});
// Error happens

What do you expect to happen?

Promise should return a list of successfully inserted instances with resulting values of autoIncrement attributes.

What is actually happening?

Unhandled rejection SequelizeDatabaseError: The target table '%TABLE_NAME_HERE%' of the DML statement cannot have any enabled triggers if the statement contains an OUTPUT clause without INTO clause.

Dialect: mssql
Database version: SQL Server 2014
Sequelize version: 3.24.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    dialect: mssqlFor issues and PRs. Things that involve MSSQL (and do not involve all dialects).type: bugDEPRECATED: replace with the "bug" issue type

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions