You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Sequelize does not generate correct SQL query when using the findAll query with a schema that contains fields with '.' characters. #9964
I have a schema with fields such as 'foo.bar.baz'
Sequelize will generate the correct 'Create Table if not exist' query but will not generate a correct
'SELECT' query with this column name. The SELECT that gets generated from this is " SELECT foo.bar.baz from
where . The SELECT query should be "SELECT foo.bar.baz. As a result the db responds with an error, (Responding with error. SequelizeBaseError: ER_BAD_FIELD_ERROR: Unknown column 'foo.bar.baz' in 'field list') which is also misleading.
The following model will reproduce with mySQL db
{
id: {
type: sequelize.UUID,
primaryKey: true
},
'foo.bar.baz': sequelize.TEXT
}
Activity
knoxcard commentedon Sep 28, 2018
I think it needs to perhaps add apostrophes, like this?
What about the table name?
sushantdhiman commentedon Oct 21, 2018
I have tagged this as a bug. May I know why you have dots in your column name?
knoxcard commentedon Oct 21, 2018
It's one personal preference to do so. I personally never heard of it until @mbecker16 mentioned it.
Here is a good reference.
https://stackoverflow.com/questions/10229287/updating-a-mysql-column-that-contains-dot-in-its-name
fix(query): correct-quote-identifiers(sequelize#9964)
tsasaki609 commentedon Nov 3, 2018
I am working on it, so please wait a little more. 😃
fix(query): correct-quote-identifiers(sequelize#9964)
fix(query): correct-quote-identifiers(sequelize#9964)
fix(query): correctly quote identifier for attributes (#9964) (#10118)
mbecker16 commentedon Nov 13, 2018
Thanks @tsasaki609 for fixing this.