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
tldr; Unit tests returns an array of objects from sqlite, but from mssql it returns an array of values
After updating to v2.3.0, a unit test for insert that used returning() started failing. The changelog reports that v2.3 introduced support for returning() for sqlite3. I tried editing my code to follow the documentation for returning(). That fixed the unit tests but I now receive the following error in my deployed environment with mssql:
Error: Undefined binding(s) detected for keys [0] when compiling RAW query: ?
Below is a code snippet showing my code before and after v2.3 and my attempt to fix it. Am I doing something wrong or this a bug?
Worked on v2.2.0
const [ id ]: number[] = await db
.insert(entity)
.into(this.table)
.returning('MyId')
// v2.2.0
// Returns: id: 123 from sqlite
// Returns: id: 123 from mssql
// v2.3.0
// Returns: id: { MyId: 123 } from sqlite
// Returns: id: 123 from mssql
Works on v2.3.0 for sqlite3 but fails on mssql
const [{ MyId }]: { MyId: number }[] = await db
.returning('MyId')
.insert(entity)
.into(this.table)
// Returns: id: 123 on sqlite3
// Returns: undefined on mssql
The text was updated successfully, but these errors were encountered:
Environment
Knex version: 2.3.0
Sqlite3 version: 5.1.2
Database + version: Microsoft SQL Server
For MSSql tag @smorey2
Bug
tldr; Unit tests returns an array of objects from sqlite, but from mssql it returns an array of values
After updating to v2.3.0, a unit test for insert that used
returning()
started failing. The changelog reports that v2.3 introduced support forreturning()
for sqlite3. I tried editing my code to follow the documentation forreturning()
. That fixed the unit tests but I now receive the following error in my deployed environment with mssql:Error: Undefined binding(s) detected for keys [0] when compiling RAW query: ?
Below is a code snippet showing my code before and after v2.3 and my attempt to fix it. Am I doing something wrong or this a bug?
Worked on v2.2.0
Works on v2.3.0 for sqlite3 but fails on mssql
The text was updated successfully, but these errors were encountered: