Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQLITE_ERROR: near "Order": syntax error during server setup process #30

Open
mahish opened this issue Jun 2, 2021 · 1 comment
Open

Comments

@mahish
Copy link

mahish commented Jun 2, 2021

Hi, I wanted to try Northwind React demo (using SQLite). Unfortunatelly, I got the following error during the server setup process (node export):

DatabaseError [SequelizeDatabaseError]: SQLITE_ERROR: near "Order": syntax error
    at Query.formatError (/Users/.../northwind-demo/server/NorthwindSequelize/node_modules/sequelize/lib/dialects/sqlite/query.js:403:16)
    at Query._handleQueryResponse (/Users/.../northwind-demo/server/NorthwindSequelize/node_modules/sequelize/lib/dialects/sqlite/query.js:72:18)
    at afterExecute (/Users/.../northwind-demo/server/NorthwindSequelize/node_modules/sequelize/lib/dialects/sqlite/query.js:238:27)
    at Statement.errBack (/Users/.../northwind-demo/server/NorthwindSequelize/node_modules/sqlite3/lib/sqlite3.js:14:21) {
  parent: [Error: SQLITE_ERROR: near "Order": syntax error] {
    errno: 1,
    code: 'SQLITE_ERROR',
    sql: 'PRAGMA foreign_key_list(Order)'
  },
  original: [Error: SQLITE_ERROR: near "Order": syntax error] {
    errno: 1,
    code: 'SQLITE_ERROR',
    sql: 'PRAGMA foreign_key_list(Order)'
  },
  sql: 'PRAGMA foreign_key_list(Order)',
  parameters: undefined
}

How to reproduce the error:

  1. in ./dbscripts run npm install sqlite3 and node sqlite-import
  2. in ./server/NorthwindSequelize run 1. npm install, npm run tsc and node export and this is when the error occurs.
@steveschmitt
Copy link
Member

Ah, you are right! The problem is that the sequelize library is not escaping the name "Order" (which is a reserved word in SQL).

I've opened a PR in sequelize to fix this.

I think I will need to change the name of the table to "Orders" in the meantime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants