-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Raw query with named substitution parameters gets quoted parameters #4494
Copy link
Copy link
Closed
Labels
good first issueFor issues. An issue that is a good choice for first-time contributors.For issues. An issue that is a good choice for first-time contributors.status: understoodFor issues. Applied when the issue is understood / reproducible.For issues. Applied when the issue is understood / reproducible.type: featureDEPRECATED: replace with the "feature" issue typeDEPRECATED: replace with the "feature" issue type
Description
I'm using sequelize to perform a simple raw query:
var queryStr = 'SELECT * FROM :tableName WHERE :deletionColumn > 0 LIMIT :limit;';
return self.connection.query(queryStr, {
replacements: {
tableName: self.name,
deletionColumn: self.options.deletionColumn,
limit: self.options.limit
}
}).then(function (rowsToDelete) {
_.each(rowsToDelete, function (row) {
log.debug('Preparing to delete row: ', row);
});
});
The resulting query however, is (from the sequelize logs):
Executing (default): SELECT * FROM 'test' WHERE 'deleted' > 0 LIMIT 421;
The generated query is invalid (table name must not be quoted).
Are there any options I can pass that'll disable the quoting?
I'm using MySQL 5.6 here.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
good first issueFor issues. An issue that is a good choice for first-time contributors.For issues. An issue that is a good choice for first-time contributors.status: understoodFor issues. Applied when the issue is understood / reproducible.For issues. Applied when the issue is understood / reproducible.type: featureDEPRECATED: replace with the "feature" issue typeDEPRECATED: replace with the "feature" issue type