-
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
Field identifiers were not quoted properly in Sqlite3 dialect #2087
Conversation
…nit tests adjusted accordingly
test/integration/schema/index.js
Outdated
@@ -469,60 +469,6 @@ module.exports = function(knex) { | |||
}); | |||
}); | |||
|
|||
describe('addColumn', function() { |
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.
Why this is removed?
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.
By mistake, sorry for that.
Hm, do you have an idea why that migration test broke on Node v4? |
Thats one random fail in oracle test, pretty annoying one. Happens in around 20% of test runs 😞 |
This is good now. I'll wait that test to complete and merge after. Thanks a lot :) |
I'm sorry to question this PR but why are we switching to backticks ?. According to the docs, the standard quote character for identifiers is 'keyword' A keyword in single quotes is a string literal. The fact that SQLite is compatible with other non-standard ways to quote identifiers like [identifier] or `identifier` does not mean we should use them. What do you think? |
And what is your suggestion instead? Would you prefer having Knex rendered (broken) SQL statements that behave in an unexpected way? Run the following example with and without this PR applied:
When the query is |
I see the problem now, sorry I did not see it before. In this case I don't think knex is at fault, or generating broken SQL as you say. I think the fault here is at SQLite for not correctly generating an error when it should. And also for recommending to use a syntax that does not work as expected. So I guess the correct way to solve this would be to report it to SQLite and hope they fix it. But I agree that fixing this in knex should be done ASAP and if this way achieves that without introducing any problems we should take it. 👍 |
FYI: it might have been wiser to do that at the begining, anyhow I just initiated a conversation about this issue on the official sqlite-dev mailing list. |
@carragom: The very same page of the official documentation that you linked, actually describes this behavior. I didn't notice it either:
|
You are right, I didn't notice either. The more reason to switch to backticks then. |
I was running into an issue today. Hopefully you can advice. I have a sqlite3 database with double quotes and it was created with knex 0.12. It is always false, because e.g. "column" !== `column`. 😮 |
Addressing #1048 and #1567