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
When using SQLite and calling queryInterface.describeTable('transaction') it fails because it does not properly quote transaction which is a reserved word.
The table transaction should be correctly queried for its structure.
What is actually happening?
I get this output:
Executing (default): CREATE TABLE IF NOT EXISTS `transaction` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `amount` FLOAT, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL);
Executing (default): PRAGMA INDEX_LIST(`transaction`)
Executing (default): SELECT name FROM `sqlite_master` WHERE type='table' and name!='sqlite_sequence';
Executing (default): PRAGMA TABLE_INFO(`transaction`);
Executing (default): PRAGMA INDEX_LIST(`transaction`)
Executing (default): PRAGMA foreign_key_list(transaction)
(node:15343) UnhandledPromiseRejectionWarning: SequelizeDatabaseError: SQLITE_ERROR: near "transaction": syntax error
at Query.formatError (/path/node_modules/sequelize/lib/dialects/sqlite/query.js:403:16)
at Query._handleQueryResponse (/path/node_modules/sequelize/lib/dialects/sqlite/query.js:72:18)
at afterExecute (/path/node_modules/sequelize/lib/dialects/sqlite/query.js:238:27)
at Statement.errBack (/path/node_modules/sqlite3/lib/sqlite3.js:14:21)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:15343) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:15343) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Note how the table name is properly quoted on the first few queries, but not on the last one, which causes it to fail.
Environment
Sequelize version: 6.6.2
Node.js version: 14.16.1
Operating System: Debian Buster
Issue Template Checklist
How does this problem relate to dialects?
I think this problem happens only for the following dialect(s): sqlite
Would you be willing to resolve this issue by submitting a Pull Request?
Maybe, when I'll have some time. But probably it's such an easy fix that someone familiar with the code can do it in 5 minutes.
The text was updated successfully, but these errors were encountered:
This issue has been automatically marked as stale because it has been open for 7 days without activity. It will be closed if no further activity occurs. If this is still an issue, just leave a comment or remove the "stale" label. 🙂
Issue Description
When using SQLite and calling
queryInterface.describeTable('transaction')
it fails because it does not properly quotetransaction
which is a reserved word.What are you doing?
Here's a small example to reproduce the issue:
What do you expect to happen?
The table
transaction
should be correctly queried for its structure.What is actually happening?
I get this output:
Note how the table name is properly quoted on the first few queries, but not on the last one, which causes it to fail.
Environment
Issue Template Checklist
How does this problem relate to dialects?
Would you be willing to resolve this issue by submitting a Pull Request?
The text was updated successfully, but these errors were encountered: