Comments (6)
Can confirm - it's specifically using the VALUES ?
special SqlDelight syntax
It should work withINSERT INTO "order" (id) VALUES (?);
from sqldelight.
@griffio thx, that will work for now.
But then you would have to call saveOrder
with many parameterssaveOrder(id, a, b, c, ...)
instead of just saveOrder(order)
.
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?
from sqldelight.
@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
e.g Add a test to allow debugging
@Test fun `issue 5298`() {
val file = FixtureCompiler.compileSql(
"""
|CREATE TABLE "order" (
| data_id INTEGER NOT NULL
|);
|selectForId:
|INSERT INTO "order" VALUES ?;
""".trimMargin(),
tempFolder,
overrideDialect = PostgreSqlDialect()
)
val column = file.compiledFile
println(column)
}
🎯 Place your debugger in some places:
You can see the difference if you use INSERT INTO "order" (data_id) VALUES (?)
vs INSERT INTO "order" VALUES ?
the table name from the sq
file is being replaced with order
Have a look and see if you want to take a try at it?
from sqldelight.
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 SqlNamedElementImpl
🔨 One potential quick fix is to use tableName.node.text
instead of using the text
accessor
e.g prefix = "${parent!!.tableName.node.text}
to get the unmodified table name
from sqldelight.
Earlier I was looking at:
but the replacements
seems to contain (?)
most of the time when debugging the unit tests.
For SELECT
queries the generated code is correct, so we could have look why that flow is producing correct results.
I will have a look and see how far I can come with this issue.
from sqldelight.
fix #5303
from sqldelight.
Related Issues (20)
- SQLDelight plugin crashes Gradle build HOT 2
- java.lang.RuntimeException in ProjectService.kt:83
- SQLite: return Long instead of data class in SUM HOT 2
- Add EXTRACT function to PostgreSql Dialect
- No plugin descriptor found at META-INF/maven/plugin.xml when running with Maven HOT 1
- java.lang.AssertionError in ProjectService.kt:83
- Can't delete HOT 1
- Cannot convert the provided notation to an object of type Dependency HOT 1
- Table not created on desktop without awaiting the result of Schema.create HOT 3
- java.lang.IllegalStateException in SqliteParserUtil.kt:114
- Unable to run `ALTER TABLE <> DROP CONSTRAINT <> RESTRICT;` when using postgresql HOT 2
- AndroidSqliteDriver fails to create single Table when not In-memory
- java.util.NoSuchElementException in UpsertClauseMixin.kt:47
- java.lang.RuntimeException in SqlDelightFileViewProviderFactory.kt:76
- java.lang.Throwable in SqlDelightFileViewProviderFactory.kt:91
- Kotlin Multiplatform build fails on macOS HOT 4
- Changes in the database are not observed when using a context other than Dispatchers.Main
- K2 Support HOT 1
- not able to create .sq file in kotlin multiplatfrom project
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sqldelight.