-
Notifications
You must be signed in to change notification settings - Fork 513
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
Keywords as column name - generated code missing double quotes for INSERT statement #5298
Comments
Can confirm - it's specifically using the It should work with |
@griffio thx, that will work for now. But then you would have to call I wouldn't mind fixing this bug myself, but it's not trivial to get into Sqldelight with all its lexing, parsing, PSI etc. Are there some docs to learn how the code works? |
@frevib issue has come up before #4877 and is not specific to Postgresql Dialect For fixing bugs, only some basic overview is given here https://github.com/cashapp/sqldelight/blob/6fa1522ca3e87b8e1379891a7d30422489198753/CONTRIBUTING.md - sadly it requires lots of trial and error to implement somethings. An entry point to investigating issues is to start by adding a test that can be debugged here Line 24 in 6fa1522
e.g Add a test to allow debugging
🎯 Place your debugger in some places: sqldelight/sqldelight-compiler/src/main/kotlin/app/cash/sqldelight/core/lang/util/TreeUtil.kt Line 182 in 6fa1522
sqldelight/sqldelight-compiler/src/main/kotlin/app/cash/sqldelight/core/lang/util/TreeUtil.kt Line 236 in 6fa1522
You can see the difference if you use Have a look and see if you want to take a try at it? |
Another issue is that sometimes the problem is located in the SqlPsi project e.g This problem could be here ??? -> https://github.com/AlecKazakova/sql-psi/blob/9d51d00e622afe3cc06c722f9cf8181b89b8dd30/core/src/main/kotlin/com/alecstrong/sql/psi/core/psi/SqlNamedElementImpl.kt#L25 The table name is being trimmed from ""order"" to "order" TreeUtil is using the sqlpsi sqldelight/sqldelight-compiler/src/main/kotlin/app/cash/sqldelight/core/lang/util/TreeUtil.kt Line 186 in 6fa1522
🔨 One potential quick fix is to use |
Earlier I was looking at: sqldelight/sqldelight-compiler/src/main/kotlin/app/cash/sqldelight/core/lang/util/TreeUtil.kt Line 236 in 6fa1522
but the For I will have a look and see how far I can come with this issue. |
fix #5303 |
SQLDelight Version
2.0.2
SQLDelight Dialect
Postgresql
Describe the Bug
Given a column name that is a keyword in Postgresql:
and
.sq
file:The following code is generated:
This results in
which is because of
order
is missing double quotes:"order"
.The code for SELECT queries does include the double quotes.
Stacktrace
No response
The text was updated successfully, but these errors were encountered: