Strange "Undefined binding(s) detected" error message
See original GitHub issueEnvironment
Knex version: 0.20.10 Database + version: Postgres 12
Bug
- Explain what kind of behaviour you are getting and how you think it should do
knex.raw("?", [
knex.insert({ id: "b", fields: { a: undefined } }).into("test"),
])
- Error message
Error: Undefined binding(s) detected for keys [] when compiling RAW query: insert into "test" ("fields", "id") values (?, ?)
This error message is puzzling. Undefined keys are not printed.
Issue Analytics
- State:
- Created 4 years ago
- Comments:14 (6 by maintainers)
Top Results From Across the Web
knex.js - Error: Undefined binding(s) detected when compiling ...
Error: Undefined binding(s) detected when compiling SELECT from Bookshelf.js save() · It happens when one of the bindings values is undefined.
Read more >Parent/Child setup : Error: Undefined binding(s) detected ...
Error : Undefined binding(s) detected when compiling WHERE. Undefined column(s): [recruits_emails.recruitID] query: where recruits_emails .
Read more >Undefined binding(s) detected when using ...
I found this by adding a log.trace('findOne') into node_modules/knex/lib/query/querycompiler.js line 109 after if (this._undefinedInWhereClause) ...
Read more >Custom Query - Undefined binding(s) detected for keys
Hi, I'm trying to write a custom query to “Insert into” a SQL table. However, I'm having trouble getting the parameters to work...
Read more >Python bindings - Nsnam - NS-3
ImportError : undefined symbol ... This can be fixed by finding the method that exists in the class declaration but that is not...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I believe this https://github.com/knex/knex/issues/3548 is related
@thekuom It’s less straightforward than I though, due to rather cluttered logic around this place, and a peculiar way raw insert is being done in original case. If you have some time to dig deeper, here’s a test case you can use for reproducing the issue:
@leventov For curiosity sake, why you building query in a such complex way?
Both of these should already work properly:
or
Does your query work correctly when value is not undefined?