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

Evaluated multi insert default for undefined already in query compiler #1396

Conversation

elhigu
Copy link
Member

@elhigu elhigu commented May 10, 2016

Drivers cannot take knex.raw replacement values as positional replacement values, so they must be evaluated already in query compile time to sql string which is passed to driver.

@elhigu
Copy link
Member Author

elhigu commented May 11, 2016

Added implementation to work with same principle with every dialect. Now knex.raw('DEFAULT') is not passed until driver, but is already lowered accordingly by query compiler. After this change e.g. invalid use of undefined will be easy to catch in prepBindings (stuff like .where('id', undefined)).

@elhigu elhigu force-pushed the evaluate-multi-insert-undefined-key-replace-already-in-query-compiler branch from 99a375e to 87a39e4 Compare May 12, 2016 07:28
@elhigu elhigu force-pushed the evaluate-multi-insert-undefined-key-replace-already-in-query-compiler branch from 87a39e4 to c935b58 Compare May 12, 2016 07:43
@elhigu
Copy link
Member Author

elhigu commented May 12, 2016

Fixes e.g. Error: Cannot find module 'pg-native'

@elhigu elhigu added the bug label May 12, 2016
@elhigu
Copy link
Member Author

elhigu commented May 12, 2016

Could @wubuzz / @rhys-vdw check this out at some point... This could be released as a part of 0.11.2 maybe? I just did hit this again and had to downgrade back to 0.10 :|

@wubzz
Copy link
Member

wubzz commented May 13, 2016

@elhigu I see nothing wrong with the code, 👍 .

I actually kind of prefer DEFAULT in the plain sql rather than a binding ? since technically it was never a used-submitted binding to begin with, so kudos to that. Looks good to me!

@elhigu elhigu merged commit 9bded93 into knex:master May 13, 2016
@elhigu elhigu deleted the evaluate-multi-insert-undefined-key-replace-already-in-query-compiler branch May 13, 2016 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants