I got a Node script with an Express server, im trying to insert a new entry into a Table. If got folloing setup:
db.run('CREATE TABLE lists(id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL)');
...
db.get(`INSERT INTO lists (name) VALUES (?) RETURNING *;`, [name], (err, row) => {
...
});
And the Insert statement throws:
Error: SQLITE_ERROR: near "RETURNING": syntax error
--> in Database#get('INSERT INTO lists (name) VALUES (?) RETURNING *;', [ 'Testing' ], [Function (anonymous)])
but this should be working according to the sqlite wiki
any advise?
Support for the
RETURNINGclause was added in Sqlite 3.35.While you have Sqlite 3.36 installed in your operating system's environment, it seems your Node environment has an older version of the
sqlite3npm package which has Sqlite 3.34.On GitHub, as of early November 2021, the
sqlite3package version5.0.2for npm was released in February 2021 with an older version of Sqlite.node-sqlite3package with Sqlite 3.36 yet.node-sqlite3does have a commit that updated Sqlite to 3.36 but no release has been made yet.