-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Fix issue with schema usage with FROM clause #4268
Conversation
IMHO, In case this PR is merged we should implement #3654 as well for consistency |
lib/query/querycompiler.js
Outdated
const isRawQuery = tableName instanceof Raw; | ||
const isFunction = typeof tableName === 'function'; | ||
|
||
if (tableName && schemaName && !isQueryBuilder && !isRawQuery && !isFunction) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since last three checks are only relevant if first three pass, I would split checks in two blocks and only resolve these conditions if first two pass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored
@Saka7 I agree. Can you either add the change to this PR or open a separate one? |
Also there are conflicts now. |
Thank you! |
Fix taken from knex#4268
Fixes issue: #1368
Related issues: #2054, #3654
Description
Prevent adding a
schema
(specified by.withSchema
) to a.from
caluse containing aQueryBuilder
,Raw
orfunction
.